Fix "go_to_previous_tab" and remove the usage of Command.win to move internally
This commit is contained in:
parent
54875e1ad5
commit
38f0cd1c32
2 changed files with 10 additions and 8 deletions
|
@ -1020,7 +1020,7 @@ class Core:
|
||||||
"""
|
"""
|
||||||
self.tabs.append(new_tab)
|
self.tabs.append(new_tab)
|
||||||
if focus:
|
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):
|
def insert_tab(self, old_pos, new_pos=99999):
|
||||||
"""
|
"""
|
||||||
|
@ -1072,11 +1072,11 @@ class Core:
|
||||||
|
|
||||||
def go_to_roster(self):
|
def go_to_roster(self):
|
||||||
"Select the roster as the current tab"
|
"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):
|
def go_to_previous_tab(self):
|
||||||
"Go to the previous tab"
|
"Go to the previous tab"
|
||||||
self.command.win(str(self.previous_tab_nb))
|
self.tabs.restore_previous_tab()
|
||||||
|
|
||||||
def go_to_important_room(self):
|
def go_to_important_room(self):
|
||||||
"""
|
"""
|
||||||
|
@ -1104,7 +1104,7 @@ class Core:
|
||||||
if (tab.nb < self.tabs.current_index
|
if (tab.nb < self.tabs.current_index
|
||||||
and tab_refs[state][-1].nb > self.tabs.current_index):
|
and tab_refs[state][-1].nb > self.tabs.current_index):
|
||||||
continue
|
continue
|
||||||
self.command.win(str(tab.nb))
|
self.tabs.set_current_tab(tab)
|
||||||
return
|
return
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -1115,7 +1115,7 @@ class Core:
|
||||||
else:
|
else:
|
||||||
tab = self.tabs.by_name_and_class(tab_name, type_)
|
tab = self.tabs.by_name_and_class(tab_name, type_)
|
||||||
if tab:
|
if tab:
|
||||||
self.command.win(str(tab.nb))
|
self.tabs.set_current_tab(tab)
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -1145,7 +1145,7 @@ class Core:
|
||||||
# if the room exists, focus it and return
|
# if the room exists, focus it and return
|
||||||
for tab in self.get_tabs(tabs.PrivateTab):
|
for tab in self.get_tabs(tabs.PrivateTab):
|
||||||
if tab.name == complete_jid:
|
if tab.name == complete_jid:
|
||||||
self.command.win(str(tab.nb))
|
self.tabs.set_current_tab(tab)
|
||||||
return tab
|
return tab
|
||||||
# create the new tab
|
# create the new tab
|
||||||
tab = self.tabs.by_name_and_class(room_name, tabs.MucTab)
|
tab = self.tabs.by_name_and_class(room_name, tabs.MucTab)
|
||||||
|
|
|
@ -229,10 +229,12 @@ class Tabs:
|
||||||
if tab is self._previous_tab:
|
if tab is self._previous_tab:
|
||||||
self._previous_tab = None
|
self._previous_tab = None
|
||||||
if is_current:
|
if is_current:
|
||||||
self._restore_previous_tab()
|
self.restore_previous_tab()
|
||||||
self._validate_current_index()
|
self._validate_current_index()
|
||||||
|
|
||||||
def _restore_previous_tab(self):
|
def restore_previous_tab(self):
|
||||||
|
"""Restore the previous tab"""
|
||||||
|
|
||||||
if self._previous_tab:
|
if self._previous_tab:
|
||||||
if not self.set_current_tab(self._previous_tab):
|
if not self.set_current_tab(self._previous_tab):
|
||||||
self.set_current_index(0)
|
self.set_current_index(0)
|
||||||
|
|
Loading…
Reference in a new issue