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
This commit is contained in:
Johannes Altmanninger 2024-08-03 17:37:43 +02:00
parent 041a26f647
commit c3c8327610

View file

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