From c3c832761038788813b0d13f992bfc866b8f0a1d Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sat, 3 Aug 2024 17:37:43 +0200 Subject: [PATCH] Stop using stack for kitty progressive enhancement Today fish pushes/pops kitty progressive enhancements everytime control is transfered to/from fish. This constitutes a regression relative to 3.7.1: $ fish $ ssh somehost fish (network disconnect, now we missed our chance to pop from the stack) $ bash # or some ncurses application etc (keyboard shortcuts like ctrl-p are broken) When invoking bash, we pop one entry off the stack but there is another one. There seems to be a simple solution: don't use the stack but always reset the current set of flags. Do that since I did not find a strong use case for using the stack[1] (Note that it was recommended by terminal developers to use the stack, so I might be wrong). Note that there is still a regression if the outer shell is bash. [1]: https://github.com/kovidgoyal/kitty/issues/7603#issuecomment-2256949384 Closes #10603 --- src/input_common.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/input_common.rs b/src/input_common.rs index 81f697279..d9b8305c6 100644 --- a/src/input_common.rs +++ b/src/input_common.rs @@ -464,7 +464,7 @@ impl TerminalProtocols { let sequences = concat!( "\x1b[?2004h", // Bracketed paste "\x1b[>4;1m", // XTerm's modifyOtherKeys - "\x1b[>5u", // CSI u with kitty progressive enhancement + "\x1b[=5u", // CSI u with kitty progressive enhancement "\x1b=", // set application keypad mode, so the keypad keys send unique codes ); FLOG!( @@ -486,10 +486,10 @@ impl TerminalProtocols { impl Drop for TerminalProtocols { fn drop(&mut self) { let sequences = concat!( - "\x1b[?2004l", - "\x1b[>4;0m", - "\x1b[<1u", // Konsole breaks unless we pass an explicit number of entries to pop. - "\x1b>", + "\x1b[?2004l", // Bracketed paste + "\x1b[>4;0m", // XTerm's modifyOtherKeys + "\x1b[=0u", // CSI u with kitty progressive enhancement + "\x1b>", // application keypad mode ); FLOG!( term_protocols,