/win's arg can be a part of the tab's name

This commit is contained in:
Florent Le Coz 2011-01-17 12:17:37 +01:00
parent b199669384
commit 6154872444

View file

@ -1009,20 +1009,23 @@ class Core(object):
try: try:
nb = int(args[0]) nb = int(args[0])
except ValueError: except ValueError:
self.command_help('win') nb = arg.strip()
return
if self.current_tab().nb == nb: if self.current_tab().nb == nb:
return return
self.previous_tab_nb = self.current_tab().nb self.previous_tab_nb = self.current_tab().nb
self.current_tab().on_lose_focus() self.current_tab().on_lose_focus()
start = self.current_tab() start = self.current_tab()
self.tabs.append(self.tabs.pop(0)) self.tabs.append(self.tabs.pop(0))
while self.current_tab().nb != nb: if isinstance(nb, int):
self.tabs.append(self.tabs.pop(0)) while self.current_tab().nb != nb:
if self.current_tab() == start: self.tabs.append(self.tabs.pop(0))
self.current_tab().set_color_state(theme.COLOR_TAB_CURRENT) if self.current_tab() == start:
self.refresh_window() break
return else:
while nb not in JID(self.current_tab().get_name()).user:
self.tabs.append(self.tabs.pop(0))
if self.current_tab() is start:
break
self.current_tab().on_gain_focus() self.current_tab().on_gain_focus()
self.refresh_window() self.refresh_window()