fix(terminal): handle omitted flags in kitty keyboard protocol push sequence (#4334)

The CSI > u sequence (push) should default omitted flags to 0 per the Kitty
keyboard protocol specification. Previously, omitted flags incorrectly
defaulted to 1, causing progressive enhancements to be enabled when they
should remain disabled.

This fix ensures push with no flags (printf "\e[>u") correctly sets flags
to 0, matching the protocol specification and making push behavior
consistent with the existing CSI = u implementation.

Author:    Anton Afanasyev <anton@doubleasoftware.com>
This commit is contained in:
Anton 2025-08-08 02:38:18 -07:00 committed by GitHub
parent 671569eb8f
commit f4e22a2a90
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3142,8 +3142,14 @@ impl Perform for Grid {
} else if c == 'u' && intermediates == &[b'>'] {
// Zellij only supports the first "progressive enhancement" layer of the kitty keyboard
// protocol
// 0 disables, everything else enables.
let count = next_param_or(0);
if !self.explicitly_disable_kitty_keyboard_protocol {
if count > 0 {
self.supports_kitty_keyboard_protocol = true;
} else {
self.supports_kitty_keyboard_protocol = false;
}
}
} else if c == 'u' && intermediates == &[b'<'] {
// Zellij only supports the first "progressive enhancement" layer of the kitty keyboard