This commit is contained in:
Kovid Goyal 2022-04-19 17:38:16 +05:30
parent 90acbd0dd5
commit b2c317ebc6
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -1030,15 +1030,18 @@ class TabManager: # {{{
except ValueError:
break
def idx_for_id(tab_id: int) -> int:
for idx, qtab in enumerate(self.tabs):
if qtab.id == tab_id:
return idx
return -1
if active_tab_needs_to_change:
next_active_tab = -1
if get_options().tab_switch_strategy == 'previous':
while self.active_tab_history and next_active_tab < 0:
tab_id = self.active_tab_history.pop()
for idx, qtab in enumerate(self.tabs):
if qtab.id == tab_id:
next_active_tab = idx
break
next_active_tab = idx_for_id(tab_id)
elif get_options().tab_switch_strategy == 'left':
next_active_tab = max(0, self.active_tab_idx - 1)
elif get_options().tab_switch_strategy == 'right':