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.
This commit is contained in:
Johannes Altmanninger
2025-03-01 14:07:26 +01:00
parent b401aee4ce
commit fe7f13e5ad
2 changed files with 5 additions and 2 deletions

View File

@@ -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"));

View File

@@ -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.