summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2018-07-23 20:40:43 +0200
committermathieui <mathieui@mathieui.net>2018-07-23 20:40:43 +0200
commit38f0cd1c32a24a2d680e60608563f52e6a24dbd3 (patch)
tree8f94d8a26999fc5b1d16556c476642a4eae95543
parent54875e1ad55348e400efe2d75efdd2b0503235e2 (diff)
downloadpoezio-38f0cd1c32a24a2d680e60608563f52e6a24dbd3.tar.gz
poezio-38f0cd1c32a24a2d680e60608563f52e6a24dbd3.tar.bz2
poezio-38f0cd1c32a24a2d680e60608563f52e6a24dbd3.tar.xz
poezio-38f0cd1c32a24a2d680e60608563f52e6a24dbd3.zip
Fix "go_to_previous_tab" and remove the usage of Command.win to move internally
-rw-r--r--poezio/core/core.py12
-rw-r--r--poezio/core/tabs.py6
2 files changed, 10 insertions, 8 deletions
diff --git a/poezio/core/core.py b/poezio/core/core.py
index eee580d5..815473ae 100644
--- a/poezio/core/core.py
+++ b/poezio/core/core.py
@@ -1020,7 +1020,7 @@ class Core:
"""
self.tabs.append(new_tab)
if focus:
- self.command.win("%s" % new_tab.nb)
+ self.tabs.set_current_tab(new_tab)
def insert_tab(self, old_pos, new_pos=99999):
"""
@@ -1072,11 +1072,11 @@ class Core:
def go_to_roster(self):
"Select the roster as the current tab"
- self.command.win('0')
+ self.tabs.set_current_tab(self.tabs.first())
def go_to_previous_tab(self):
"Go to the previous tab"
- self.command.win(str(self.previous_tab_nb))
+ self.tabs.restore_previous_tab()
def go_to_important_room(self):
"""
@@ -1104,7 +1104,7 @@ class Core:
if (tab.nb < self.tabs.current_index
and tab_refs[state][-1].nb > self.tabs.current_index):
continue
- self.command.win(str(tab.nb))
+ self.tabs.set_current_tab(tab)
return
return
@@ -1115,7 +1115,7 @@ class Core:
else:
tab = self.tabs.by_name_and_class(tab_name, type_)
if tab:
- self.command.win(str(tab.nb))
+ self.tabs.set_current_tab(tab)
return True
return False
@@ -1145,7 +1145,7 @@ class Core:
# if the room exists, focus it and return
for tab in self.get_tabs(tabs.PrivateTab):
if tab.name == complete_jid:
- self.command.win(str(tab.nb))
+ self.tabs.set_current_tab(tab)
return tab
# create the new tab
tab = self.tabs.by_name_and_class(room_name, tabs.MucTab)
diff --git a/poezio/core/tabs.py b/poezio/core/tabs.py
index e9646959..81ad155d 100644
--- a/poezio/core/tabs.py
+++ b/poezio/core/tabs.py
@@ -229,10 +229,12 @@ class Tabs:
if tab is self._previous_tab:
self._previous_tab = None
if is_current:
- self._restore_previous_tab()
+ self.restore_previous_tab()
self._validate_current_index()
- def _restore_previous_tab(self):
+ def restore_previous_tab(self):
+ """Restore the previous tab"""
+
if self._previous_tab:
if not self.set_current_tab(self._previous_tab):
self.set_current_index(0)