From 51362706d78912a28cfd5e618bf06a756bcc0ac6 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 19 Apr 2022 17:44:01 +0530 Subject: [PATCH] Fix closing a tab incorrectly storing the tab to its right in the active tab history --- kitty/tabs.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/kitty/tabs.py b/kitty/tabs.py index e51a27fd2..8e4b6beda 100644 --- a/kitty/tabs.py +++ b/kitty/tabs.py @@ -829,8 +829,11 @@ class TabManager: # {{{ if visible_before and not self.tab_bar_should_be_visible: self.tabbar_visibility_changed() - def _set_active_tab(self, idx: int) -> None: - self.active_tab_idx = idx + def _set_active_tab(self, idx: int, store_in_history: bool = True) -> None: + if store_in_history: + self.active_tab_idx = idx + else: + self._active_tab_idx = idx set_active_tab(self.os_window_id, idx) def tabbar_visibility_changed(self) -> None: @@ -1050,7 +1053,7 @@ class TabManager: # {{{ if next_active_tab < 0: next_active_tab = max(0, min(self.active_tab_idx, len(self.tabs) - 1)) - self._set_active_tab(next_active_tab) + self._set_active_tab(next_active_tab, store_in_history=False) elif active_tab_before_removal is not None: try: idx = self.tabs.index(active_tab_before_removal)