Change tab search behavior to select first matching tab, and cycle back the list.
This commit is contained in:
parent
3317604c65
commit
6626208983
1 changed files with 6 additions and 8 deletions
|
@ -211,19 +211,17 @@ class CommandCore:
|
||||||
return
|
return
|
||||||
self.core.current_tab_nb = number
|
self.core.current_tab_nb = number
|
||||||
else:
|
else:
|
||||||
matchs = []
|
match = None
|
||||||
target_tabs = self.core.tabs[self.core.current_tab_nb+1:]
|
target_tabs = self.core.tabs[self.core.current_tab_nb+1:] \
|
||||||
if not target_tabs:
|
+ self.core.tabs[:self.core.current_tab_nb]
|
||||||
target_tabs = self.core.tabs
|
|
||||||
for tab in target_tabs:
|
for tab in target_tabs:
|
||||||
for tab_name in tab.matching_names():
|
for tab_name in tab.matching_names():
|
||||||
if tab_name[1] and name in tab_name[1].lower():
|
if tab_name[1] and name in tab_name[1].lower():
|
||||||
matchs.append((tab_name[0], tab))
|
match = tab
|
||||||
if not matchs:
|
if match is None:
|
||||||
self.core.previous_tab_nb = prev_nb
|
self.core.previous_tab_nb = prev_nb
|
||||||
return
|
return
|
||||||
tab = min(matchs, key=lambda m: m[0])[1]
|
self.core.current_tab_nb = match.nb
|
||||||
self.core.current_tab_nb = tab.nb
|
|
||||||
old_tab.on_lose_focus()
|
old_tab.on_lose_focus()
|
||||||
self.core.current_tab().on_gain_focus()
|
self.core.current_tab().on_gain_focus()
|
||||||
self.core.refresh_window()
|
self.core.refresh_window()
|
||||||
|
|
Loading…
Reference in a new issue