aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabian Boehm <FHomborg@gmail.com>2025-01-17 11:33:02 +0100
committerGitHub <noreply@github.com>2025-01-17 11:33:02 +0100
commit0075548adcfadc8f1c30d6a2fbc31272cdc12fbf (patch)
tree5b991ccc6624eaeee2b3a11edb3d78e9d39d5739
parentdocs(changelog): mouse any event tracking (diff)
downloadsl0ppij-0075548adcfadc8f1c30d6a2fbc31272cdc12fbf.tar.gz
sl0ppij-0075548adcfadc8f1c30d6a2fbc31272cdc12fbf.tar.xz
sl0ppij-0075548adcfadc8f1c30d6a2fbc31272cdc12fbf.zip
fix(terminal): support kitty keyboard protocol setting with "=" (#3942)
From https://sw.kovidgoyal.net/kitty/keyboard-protocol/#progressive-enhancement: > The escape code for requesting enhancements is: > CSI = flags ; mode u That means it can be *set* with CSI =, not just pushed/popped onto the stack with CSI < and CSI >. This is important because otherwise zellij would interpret this as restore_cursor_position, which would move the cursor. This would be hit by the next fish-shell release, which sends CSI = 5 u and CSI = 0 u to enable/disable the kitty keyboard enhancements unconditionally, so if you used any program that saved the cursor position it would constantly move your cursor back on every prompt. Fixes #3852
-rw-r--r--zellij-server/src/panes/grid.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/zellij-server/src/panes/grid.rs b/zellij-server/src/panes/grid.rs
index 95c3be59..ea2ec67e 100644
--- a/zellij-server/src/panes/grid.rs
+++ b/zellij-server/src/panes/grid.rs
@@ -2992,6 +2992,17 @@ impl Perform for Grid {
"\u{1b}[?0u"
};
self.pending_messages_to_pty.push(reply.as_bytes().to_vec());
+ } else if c == 'u' && intermediates == &[b'='] {
+ // kitty keyboard protocol without the stack, just setting.
+ // 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' {
self.restore_cursor_position();
} else if c == '@' {