Repository: zellij-org/zellij (language: rust)

Issue:
`Ctrl-Backspace` is mapped to `Ctrl-H` even when `support_kitty_keyboard_protocol true`
# 2. Issues with the Zellij UI / behavior / crash

I test this by using `fish_key_reader`, which comes with `fish`:

1. Open `zellij`
2. Run `fish_key_reader`
3. Type `Ctrl-Backspace`

Expected: The terminal sees `Ctrl-Backspace`

Observed: The terminal sees `Ctrl-H`.

This is on macOS 15.1.1 iTerm 3.5.10 with `CSI u` enabled. `Ctrl-Backspace` is sent to the shell as `Ctrl-Backspace` consistently outside `zellij`, and the issue only occurs when I'm in `zellij`. So I'm fairly certain it's an issue with `zellij` and not my other configuration.

I tried enabling `support_kitty_keyboard_protocol true` in `config.kdl`, then `killall zellij` to make sure `zellij` is running nowhere on the system. This still doesn't fix the issue.


Discussion / hints:
Same here

```
OS: CachyOS Linux x86_64
Kernel: Linux 6.12.6-2-cachyos
DE: KDE Plasma 6.2.4
WM: KWin (Wayland)

kitty --version
kitty 0.37.0 created by Kovid Goyal

zellij --version
zellij 0.41.2

fish --version
fish, version 4.0b1-13-g541f8b47b
```
I'm reasonably sure this is because zellij [requires the `\x1b[>Xu` version](https://github.com/zellij-org/zellij/blob/3dda02f44e06a5137da6139492997e0a77a757c1/zellij-server/src/panes/grid.rs#L2868-L2874), while fish [sends `\x1b[=5u`](https://github.com/fish-shell/fish-shell/blob/9b67b2ae070bf29060e8d2c10a9d127fc1bf2dcf/src/input_common.rs#L451) - which [is allowed](https://sw.kovidgoyal.net/kitty/keyboard-protocol/#progressive-enhancement) (and skips the stack, if I'm reading correctly):

> The escape code for requesting enhancements is:

>     CSI = flags ; mode u


Fix patch:
diff --git a/zellij-server/src/panes/grid.rs b/zellij-server/src/panes/grid.rs
index 95c3be59ba..ea2ec67e99 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 == '@' {


Test patch: