Fix inactive tab closing causing active tab to change

Fixes #3398
This commit is contained in:
Kovid Goyal 2021-03-16 18:06:01 +05:30
parent d360d077d1
commit b063c8cda1
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 19 additions and 15 deletions

View File

@ -91,6 +91,8 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
- Graphics protocol: Fix suppression of responses not working for chunked - Graphics protocol: Fix suppression of responses not working for chunked
transmission (:iss:`3375`) transmission (:iss:`3375`)
- Fix inactive tab closing causing active tab to change (:iss:`3398`)
0.19.3 [2020-12-19] 0.19.3 [2020-12-19]
------------------- -------------------

View File

@ -745,13 +745,15 @@ class TabManager: # {{{
def remove(self, tab: Tab) -> None: def remove(self, tab: Tab) -> None:
self._remove_tab(tab) self._remove_tab(tab)
next_active_tab = -1 active_tab_needs_to_change = self.active_tab is None or self.active_tab is tab
while True: while True:
try: try:
self.active_tab_history.remove(tab.id) self.active_tab_history.remove(tab.id)
except ValueError: except ValueError:
break break
if active_tab_needs_to_change:
next_active_tab = -1
if self.opts.tab_switch_strategy == 'previous': if self.opts.tab_switch_strategy == 'previous':
while self.active_tab_history and next_active_tab < 0: while self.active_tab_history and next_active_tab < 0:
tab_id = self.active_tab_history.pop() tab_id = self.active_tab_history.pop()