diff options
author | Myk <politas@gmail.com> | 2020-08-02 20:03:39 +1000 |
---|---|---|
committer | Myk <politas@gmail.com> | 2020-08-02 20:03:39 +1000 |
commit | 6189847e8cd583fdf276e63d11fa8896f8f7c39e (patch) | |
tree | 47d02cd619ae44a1437fcb8abd6580bb32bc64ac /ranger | |
parent | 4cb09a536923334d443853f3da5b7481d0c40d03 (diff) | |
parent | 9ddccb282b7fd10bbeb63c5a9df625d95160bcff (diff) | |
download | ranger-6189847e8cd583fdf276e63d11fa8896f8f7c39e.tar.gz |
Merge branch 'fix/1880-multipane-status' of https://github.com/politas/ranger into fix/1880-multipane-status
Diffstat (limited to 'ranger')
-rw-r--r-- | ranger/core/tab.py | 22 | ||||
-rw-r--r-- | ranger/gui/widgets/browsercolumn.py | 2 |
2 files changed, 22 insertions, 2 deletions
diff --git a/ranger/core/tab.py b/ranger/core/tab.py index cd30d329..64edf120 100644 --- a/ranger/core/tab.py +++ b/ranger/core/tab.py @@ -19,7 +19,9 @@ class Tab(FileManagerAware, SettingsAware): # pylint: disable=too-many-instance self._thisfile = None # Current File self.history = History(self.settings.max_history_size, unique=False) self.last_search = None - self.pointer = 0 + self._pointer = 0 + self._pointed_obj = None + self.pointed_obj = None self.path = abspath(expanduser(path)) self.pathway = () # NOTE: in the line below, weak=True works only in python3. In python2, @@ -36,6 +38,7 @@ class Tab(FileManagerAware, SettingsAware): # pylint: disable=too-many-instance self._thisfile = signal.new if self == self.fm.thistab: self.pointer = self.thisdir.pointer + self.pointed_obj = self.thisdir.pointed_obj def _on_tab_change(self, signal): if self == signal.new and self.thisdir: @@ -53,6 +56,23 @@ class Tab(FileManagerAware, SettingsAware): # pylint: disable=too-many-instance thisfile = property(_get_thisfile, _set_thisfile) + def _get_pointer(self): + if ( + self.thisdir is not None + and self.thisdir.files[self._pointer] != self._pointed_obj + ): + try: + self._pointer = self.thisdir.files.index(self._pointed_obj) + except ValueError: + self._pointed_obj = self.thisdir.files[self._pointer] + return self._pointer + + def _set_pointer(self, value): + self._pointer = value + self._pointed_obj = self.thisdir.files[self._pointer] + + pointer = property(_get_pointer, _set_pointer) + def at_level(self, level): """Returns the FileSystemObject at the given level. diff --git a/ranger/gui/widgets/browsercolumn.py b/ranger/gui/widgets/browsercolumn.py index 330823b3..e6f5180f 100644 --- a/ranger/gui/widgets/browsercolumn.py +++ b/ranger/gui/widgets/browsercolumn.py @@ -413,7 +413,7 @@ class BrowserColumn(Pager): # pylint: disable=too-many-instance-attributes self.color_reset() def _get_index_of_selected_file(self): - if self.fm.ui.viewmode == 'multipane' and self.tab: + if self.fm.ui.viewmode == 'multipane' and self.tab != self.fm.thistab: return self.tab.pointer return self.target.pointer |