mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-28 19:21:38 +02:00
Fix removal of inactive tab that is before the currently active tab causing the highlighted tab to be incorrect
Fixes #3516
This commit is contained in:
@@ -16,6 +16,10 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
|
|||||||
- Fix ``kitty @ close-tab`` not working with pipe based remote control
|
- Fix ``kitty @ close-tab`` not working with pipe based remote control
|
||||||
(:iss:`3510`)
|
(:iss:`3510`)
|
||||||
|
|
||||||
|
- Fix removal of inactive tab that is before the currently active tab causing
|
||||||
|
the highlighted tab to be incorrect (:iss:`3516`)
|
||||||
|
|
||||||
|
|
||||||
0.20.1 [2021-04-19]
|
0.20.1 [2021-04-19]
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
|
|||||||
@@ -687,7 +687,10 @@ class TabManager: # {{{
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def active_tab(self) -> Optional[Tab]:
|
def active_tab(self) -> Optional[Tab]:
|
||||||
return self.tabs[self.active_tab_idx] if self.tabs else None
|
try:
|
||||||
|
return self.tabs[self.active_tab_idx] if self.tabs else None
|
||||||
|
except Exception:
|
||||||
|
return None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def active_window(self) -> Optional[Window]:
|
def active_window(self) -> Optional[Window]:
|
||||||
@@ -750,6 +753,7 @@ class TabManager: # {{{
|
|||||||
return self.tabs[idx]
|
return self.tabs[idx]
|
||||||
|
|
||||||
def remove(self, tab: Tab) -> None:
|
def remove(self, tab: Tab) -> None:
|
||||||
|
active_tab_before_removal = self.active_tab
|
||||||
self._remove_tab(tab)
|
self._remove_tab(tab)
|
||||||
try:
|
try:
|
||||||
active_tab_needs_to_change = self.active_tab is None or self.active_tab is tab
|
active_tab_needs_to_change = self.active_tab is None or self.active_tab is tab
|
||||||
@@ -779,6 +783,13 @@ class TabManager: # {{{
|
|||||||
next_active_tab = max(0, min(self.active_tab_idx, len(self.tabs) - 1))
|
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)
|
||||||
|
elif active_tab_before_removal is not None:
|
||||||
|
try:
|
||||||
|
idx = self.tabs.index(active_tab_before_removal)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
self._active_tab_idx = idx
|
||||||
self.mark_tab_bar_dirty()
|
self.mark_tab_bar_dirty()
|
||||||
tab.destroy()
|
tab.destroy()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user