diff options
-rw-r--r-- | ranger/core/actions.py | 7 | ||||
-rw-r--r-- | ranger/core/tab.py | 2 |
2 files changed, 6 insertions, 3 deletions
diff --git a/ranger/core/actions.py b/ranger/core/actions.py index b7205dc5..24b115de 100644 --- a/ranger/core/actions.py +++ b/ranger/core/actions.py @@ -838,6 +838,7 @@ class Actions(FileManagerAware, EnvironmentAware, SettingsAware): def tab_open(self, name, path=None): tab_has_changed = (name != self.current_tab) self.current_tab = name + previous_tab = self.thistab try: tab = self.tabs[name] except KeyError: @@ -851,7 +852,7 @@ class Actions(FileManagerAware, EnvironmentAware, SettingsAware): if tab_has_changed: self.change_mode('normal') - self.signal_emit('tab.change') + self.signal_emit('tab.change', old=previous_tab, new=self.thistab) def tab_close(self, name=None): if name is None: @@ -869,6 +870,7 @@ class Actions(FileManagerAware, EnvironmentAware, SettingsAware): def tab_restore(self): # NOTE: The name of the tab is not restored. + previous_tab = self.thistab if self.restorable_tabs: tab = self.restorable_tabs.pop() for name in range(1, len(self.tabs) + 2): @@ -878,7 +880,8 @@ class Actions(FileManagerAware, EnvironmentAware, SettingsAware): tab.enter_dir(tab.path) self.thistab = tab self.change_mode('normal') - self.signal_emit('tab.change') + self.signal_emit('tab.change', old=previous_tab, + new=self.thistab) break def tab_move(self, offset): diff --git a/ranger/core/tab.py b/ranger/core/tab.py index 0244adec..e5605f28 100644 --- a/ranger/core/tab.py +++ b/ranger/core/tab.py @@ -28,7 +28,7 @@ class Tab(FileManagerAware, SettingsAware): self.pointer = self.thisdir.pointer def _on_tab_change(self, signal): - if self == self.fm.thistab and self.thisdir: + if self == signal.new and self.thisdir: # restore the pointer whenever this tab is reopened self.thisdir.pointer = self.pointer self.thisdir.correct_pointer() |