From fe7f13e5ada94f86a43db8e6c1330bdacbc9aede Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sat, 1 Mar 2025 14:07:26 +0100 Subject: [PATCH] Fix fish_key_reader regression causing kitty protcol not being requested Commit 2d234bb676 (Only request keyboard protocols once we know if kitty kbd is supported, 2025-01-26) queries support for the kitty protocol and acted upon it after having read next character. Unfortunately this meant that we don't turn on the kitty protocol until after we read a character -- since the CSI ? u response does not generate a char event. Let's query for primary DA additionally, matching what fish does. In future, we should do a timed wait as well, to avoid terminal responses leaking when there we exit fish_key_reader too quickly. --- src/builtins/fish_key_reader.rs | 5 ++++- src/reader.rs | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/builtins/fish_key_reader.rs b/src/builtins/fish_key_reader.rs index 74342a7bd..da199d8fe 100644 --- a/src/builtins/fish_key_reader.rs +++ b/src/builtins/fish_key_reader.rs @@ -27,7 +27,7 @@ panic::panic_handler, print_help::print_help, proc::set_interactive_session, - reader::{check_exit_loop_maybe_warning, reader_init}, + reader::{check_exit_loop_maybe_warning, reader_init, QUERY_PRIMARY_DEVICE_ATTRIBUTE}, signal::signal_set_handlers, threads, topic_monitor::topic_monitor_init, @@ -138,6 +138,9 @@ fn setup_and_process_keys(streams: &mut IoStreams, continuous_mode: bool, verbos streams .out .append(str2wcstring(kitty_progressive_enhancements_query())); + streams + .out + .append(str2wcstring(QUERY_PRIMARY_DEVICE_ATTRIBUTE)); if continuous_mode { streams.err.append(L!("\n")); diff --git a/src/reader.rs b/src/reader.rs index a9773dbcb..d542a55ec 100644 --- a/src/reader.rs +++ b/src/reader.rs @@ -2126,7 +2126,7 @@ fn jump( } } -const QUERY_PRIMARY_DEVICE_ATTRIBUTE: &[u8] = b"\x1b[0c"; +pub const QUERY_PRIMARY_DEVICE_ATTRIBUTE: &[u8] = b"\x1b[0c"; impl<'a> Reader<'a> { /// Read a command to execute, respecting input bindings.