diff --git a/kitty/boss.py b/kitty/boss.py index 28fb4e04d..da30260f5 100755 --- a/kitty/boss.py +++ b/kitty/boss.py @@ -551,6 +551,10 @@ class Boss: if not needs_confirmation: self.close_tab_no_confirm(tab) return + if tab is not self.active_tab: + tm = tab.tab_manager_ref() + if tm is not None: + tm.set_active_tab(tab) self._run_kitten('ask', ['--type=yesno', '--message', _( 'Are you sure you want to close this tab, it has {}' ' windows running?').format(num)], diff --git a/kitty/tabs.py b/kitty/tabs.py index d75ecebdb..ecc459f62 100644 --- a/kitty/tabs.py +++ b/kitty/tabs.py @@ -999,7 +999,6 @@ class TabManager: # {{{ self.set_active_tab_idx(i) elif button == GLFW_MOUSE_BUTTON_MIDDLE: tab = self.tabs[i] - self.set_active_tab(tab) get_boss().close_tab(tab) self.recent_mouse_events.append(TabMouseEvent(button, modifiers, action, now, i)) if len(self.recent_mouse_events) > 5: