From 310b7eca6873079c9af01c23a255c680069fab95 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Thu, 25 Sep 2025 18:20:31 +0200 Subject: [PATCH] Only initialize kitty keyboard capability on startup If the initial query is interrupted by ctrl-c, we leave it unset. A later rogue "\e[?0u" reply would make us enable it, which seems surprising. Fix that by always setting the capability if we're gonna read from stdin. --- src/reader.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/reader.rs b/src/reader.rs index 169e0c8f9..68268851f 100644 --- a/src/reader.rs +++ b/src/reader.rs @@ -276,6 +276,7 @@ pub fn terminal_init() -> InputEventQueue { let mut input_queue = InputEventQueue::new(STDIN_FILENO); let _init_tty_metadata = ScopeGuard::new((), |()| { + maybe_set_kitty_keyboard_capability(false); initialize_tty_metadata(XTVERSION.get_or_init(WString::new)); }); @@ -303,7 +304,6 @@ pub fn terminal_init() -> InputEventQueue { Implicit(CheckExit) => {} Implicit(QueryInterrupted) => break, CharEvent::QueryResult(Response(QueryResponse::PrimaryDeviceAttribute) | Timeout) => { - maybe_set_kitty_keyboard_capability(false); break; } CharEvent::QueryResult(Response(_)) => (),