diff options
author | hut <hut@lavabit.com> | 2012-08-05 15:52:53 +0200 |
---|---|---|
committer | hut <hut@lavabit.com> | 2012-08-05 15:52:53 +0200 |
commit | 90ce9ed7545b733fb1ec9e769c10bba6e3fd4ab2 (patch) | |
tree | a2de6f9a9cc832ffa41055f259a4b23284c84133 | |
parent | a8c5614b8e3092d307b917654eb085f4b8aa87cf (diff) | |
download | ranger-90ce9ed7545b733fb1ec9e769c10bba6e3fd4ab2.tar.gz |
core.tab: save and restore pointer when changing tab
-rw-r--r-- | ranger/core/tab.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/ranger/core/tab.py b/ranger/core/tab.py index bf837df3..0244adec 100644 --- a/ranger/core/tab.py +++ b/ranger/core/tab.py @@ -14,14 +14,24 @@ class Tab(FileManagerAware, SettingsAware): self._thisfile = None # Current File self.history = History(self.settings.max_history_size, unique=False) self.last_search = None + self.pointer = 0 self.path = abspath(expanduser(path)) self.pathway = () self.fm.signal_bind('move', self._set_thisfile_from_signal, priority=0.1, weak=True) + self.fm.signal_bind('tab.change', self._on_tab_change, weak=True) def _set_thisfile_from_signal(self, signal): if self == signal.tab: self._thisfile = signal.new + if self == self.fm.thistab: + self.pointer = self.thisdir.pointer + + def _on_tab_change(self, signal): + if self == self.fm.thistab and self.thisdir: + # restore the pointer whenever this tab is reopened + self.thisdir.pointer = self.pointer + self.thisdir.correct_pointer() def _set_thisfile(self, value): if value is not self._thisfile: |