From 2eb5d4deca4cb0cd67eec401171b85371fc37676 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 5 Aug 2025 11:48:21 +0530 Subject: [PATCH] Properly cancel visual select mode on OS window close request --- kitty/boss.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kitty/boss.py b/kitty/boss.py index 4d32fe0ff..9d168a6ef 100644 --- a/kitty/boss.py +++ b/kitty/boss.py @@ -916,7 +916,7 @@ class Boss: window.send_cmd_response(response) def mark_os_window_for_close(self, os_window_id: int, request_type: int = IMPERATIVE_CLOSE_REQUESTED) -> None: - if self.current_visual_select is not None and self.current_visual_select.os_window_id == os_window_id and request_type == IMPERATIVE_CLOSE_REQUESTED: + if self.current_visual_select is not None and self.current_visual_select.os_window_id == os_window_id: self.cancel_current_visual_select() mark_os_window_for_close(os_window_id, request_type) @@ -1504,6 +1504,7 @@ class Boss: if self.current_visual_select: self.current_visual_select.cancel() self.current_visual_select = None + self.mappings.pop_keyboard_mode_if_is('__visual_select__') def visual_window_select_action( self, tab: Tab, @@ -1827,6 +1828,8 @@ class Boss: if tm is None: self.mark_os_window_for_close(os_window_id) return + if self.current_visual_select is not None and self.current_visual_select.os_window_id == os_window_id: + self.cancel_current_visual_select() active_window = tm.active_window windows = [] for tab in tm: