mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-06 16:05:05 +02:00
When calling the active tab idx setter do not re-record the current tab in the active tab history if the current tab will not actually change. Fixes #3871
This commit is contained in:
@@ -625,6 +625,9 @@ class TabManager: # {{{
|
||||
|
||||
@active_tab_idx.setter
|
||||
def active_tab_idx(self, val: int) -> None:
|
||||
new_active_tab_idx = max(0, min(val, len(self.tabs) - 1))
|
||||
if new_active_tab_idx == self._active_tab_idx:
|
||||
return
|
||||
try:
|
||||
old_active_tab: Optional[Tab] = self.tabs[self._active_tab_idx]
|
||||
except Exception:
|
||||
@@ -632,7 +635,7 @@ class TabManager: # {{{
|
||||
else:
|
||||
assert old_active_tab is not None
|
||||
add_active_id_to_history(self.active_tab_history, old_active_tab.id)
|
||||
self._active_tab_idx = max(0, min(val, len(self.tabs) - 1))
|
||||
self._active_tab_idx = new_active_tab_idx
|
||||
try:
|
||||
new_active_tab: Optional[Tab] = self.tabs[self._active_tab_idx]
|
||||
except Exception:
|
||||
|
||||
Reference in New Issue
Block a user