fix: opencode (and kitty-probing TUIs) lose Backspace inside rmux#103
Open
wiwiwa wants to merge 1 commit into
Open
fix: opencode (and kitty-probing TUIs) lose Backspace inside rmux#103wiwiwa wants to merge 1 commit into
wiwiwa wants to merge 1 commit into
Conversation
rmux answered the kitty-keyboard capability query (CSI ? u) with the current mode, signalling support to applications. The kitty key encoding is partial (trivial keys such as Backspace are always sent as legacy bytes), so applications that probed and then enabled kitty mode (notably opencode) mis-parsed Backspace (0x7f). Real tmux does not answer this query. Stop replying to the query so probing applications stay in legacy input mode. The push/set/pop handling is left intact for a future complete implementation.
Author
|
This is fix for #102 |
Author
|
Closing — the fix did not resolve Backspace in testing. The kitty-query advertisement was not the (whole) cause; needs deeper investigation. Thanks. |
Author
|
Follow-up: the earlier "didn't work" was operator error — the running rmux daemon (old binary) hadn't been restarted. Verified the fix by running an isolated daemon on a separate socket ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Backspace does not work for opencode when run inside an rmux pane (Ctrl+Backspace works; plain Backspace is dead). ESC and other keys are fine. Backspace works for opencode in plain xterm and in real tmux.
Root cause
rmux's terminal emulator answered the kitty-keyboard capability query
CSI ? uwithCSI ? {flags} u, advertising support for the kitty-keyboard protocol. Real tmux 3.x does not answer it.Probing applications (opencode / Bubble Tea) see the reply, conclude the terminal supports kitty keyboard, and switch into kitty/CSI-u input mode. rmux's kitty key encoding is only partial — trivial keys such as Backspace are always emitted as legacy bytes (
0x7f) regardless of mode (input_keys.rs:58). The app therefore expectsCSI 127 uand never recognises the bare0x7f, so Backspace is dropped.Ctrl+Backspace(0x08→ Ctrl-H) survives because most parsers map it to delete independently.Captured side-by-side from detached panes:
CSI ? u(kitty kb query)CSI ? 0 u(answers)A live-attach byte capture confirmed rmux delivers the correct
0x7ffor plain Backspace and0x08for Ctrl+Backspace, with no stray bytes — so this is not an input-forwarding bug.Fix
Stop replying to the kitty-keyboard query (
CsiCommand::KittyKeyboardQuery→ no-op), matching tmux. Probing applications stay in legacy input mode and Backspace works.Intentionally minimal: the kitty push/set/pop handlers and
MODE_KEYS_KITTYtracking are left in place as scaffolding for a future complete kitty-keyboard implementation. A full implementation would also need: per-flag tracking (report-all etc.), a push/pop stack, event-type fields, and CSI-u encoding for trivial keys.Verification
cargo test -p rmux-core --lib→ 907 passed, 0 failed (incl. the updated kitty query test).cargo fmt --all --check→ clean.cargo clippy -p rmux-core --all-targets --locked -- -D warnings→ clean.