diff options
author | mathieui <mathieui@mathieui.net> | 2014-12-09 01:13:14 +0100 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2014-12-09 01:13:14 +0100 |
commit | ed7fe693b4e2a4354a7db58d03bc74f155f1ad71 (patch) | |
tree | ff10ed17bb8975864a1914ab5c0415db00abf3ec /src | |
parent | 7b3265c636baef56e0468891cff236a462dad0a2 (diff) | |
download | poezio-ed7fe693b4e2a4354a7db58d03bc74f155f1ad71.tar.gz poezio-ed7fe693b4e2a4354a7db58d03bc74f155f1ad71.tar.bz2 poezio-ed7fe693b4e2a4354a7db58d03bc74f155f1ad71.tar.xz poezio-ed7fe693b4e2a4354a7db58d03bc74f155f1ad71.zip |
Fix #2802 (add a /closeall command, with a new plugin)
Diffstat (limited to 'src')
-rw-r--r-- | src/core/core.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/core/core.py b/src/core/core.py index 79d19087..f6b973ec 100644 --- a/src/core/core.py +++ b/src/core/core.py @@ -1286,6 +1286,7 @@ class Core(object): """ Close the given tab. If None, close the current one """ + was_current = tab is None tab = tab or self.current_tab() if isinstance(tab, tabs.RosterInfoTab): return # The tab 0 should NEVER be closed @@ -1293,9 +1294,10 @@ class Core(object): del tab.commands # and make the object collectable tab.on_close() nb = tab.nb - if self.previous_tab_nb != nb: - self.current_tab_nb = self.previous_tab_nb - self.previous_tab_nb = 0 + if was_current: + if self.previous_tab_nb != nb: + self.current_tab_nb = self.previous_tab_nb + self.previous_tab_nb = 0 if config.get('create_gaps'): if nb >= len(self.tabs) - 1: self.tabs.remove(tab) @@ -1315,7 +1317,8 @@ class Core(object): self.current_tab_nb = len(self.tabs) - 1 while not self.tabs[self.current_tab_nb]: self.current_tab_nb -= 1 - self.current_tab().on_gain_focus() + if was_current: + self.current_tab().on_gain_focus() self.refresh_window() import gc gc.collect() |