Skip to content

fix(tmux): only enable extended-keys when outer terminal supports CSI u#418

Merged
asheshgoplani merged 1 commit intoasheshgoplani:mainfrom
afterthought:fix/extended-keys-terminal-compat
Mar 26, 2026
Merged

fix(tmux): only enable extended-keys when outer terminal supports CSI u#418
asheshgoplani merged 1 commit intoasheshgoplani:mainfrom
afterthought:fix/extended-keys-terminal-compat

Conversation

@afterthought
Copy link
Copy Markdown
Contributor

Summary

Fixes #417

agent-deck unconditionally enables tmux extended-keys on, which breaks Shift+key combos in terminals that don't support the CSI u / kitty keyboard protocol (cmux, Alacritty, Terminal.app, etc.).

  • Add outerTerminalSupportsExtKeys() that checks TERM and TERM_PROGRAM to detect CSI u-capable terminals (Ghostty, kitty, WezTerm)
  • cmux sets TERM=xterm-ghostty without supporting CSI u — we check TERM_PROGRAM to distinguish real Ghostty
  • Only enable extended-keys on and append extkeys to terminal-features when the outer terminal supports it
  • Default to off — breaking Shift+key is worse than missing extended key reports
  • Both call sites updated (session creation in Start and StartQuick)

Test plan

  • TestOuterTerminalSupportsExtKeys — 14 cases covering Ghostty, cmux-as-ghostty, kitty, WezTerm, plain xterm, tmux, screen, unknown terminals, and TERM_PROGRAM-only detection
  • Full build passes (go build ./...)
  • Manual: Shift+R works in agent-deck TUI inside cmux after this change
  • Manual: Shift+R still works in Ghostty (extended-keys enabled)

🤖 Generated with Claude Code

agent-deck unconditionally sets `extended-keys on` and appends `extkeys`
to `terminal-features` on every session create/restart. This breaks
Shift+key combos (Shift+R, Shift+D, etc.) in terminal emulators that
don't support the CSI u / kitty keyboard protocol, because tmux encodes
modified keys as CSI sequences that the terminal silently drops.

Add `outerTerminalSupportsExtKeys()` that checks TERM and TERM_PROGRAM
to detect terminals known to support the protocol (Ghostty, kitty,
WezTerm). Notably, cmux sets TERM=xterm-ghostty but does not support
CSI u, so we check TERM_PROGRAM to distinguish real Ghostty from cmux.

Default to off — breaking Shift+key input is worse than missing extended
key reports for the majority of users.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Steven17D pushed a commit to Steven17D/agent-deck that referenced this pull request Mar 25, 2026
@asheshgoplani asheshgoplani merged commit 8d18873 into asheshgoplani:main Mar 26, 2026
1 check passed
asheshgoplani added a commit that referenced this pull request Mar 26, 2026
Reverts #422 (Ctrl+Q bind), #420 (ANSI reset), #418 (extended-keys CSI u),
#394 (keyboard mode after detach). These changes broke session creation and
restart on macOS due to terminal capability detection differences.

Also adds schema migration upgrade tests for statedb.

Committed by Ashesh Goplani
Steven17D pushed a commit to Steven17D/agent-deck that referenced this pull request Mar 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

extended-keys breaks Shift+key in terminals without CSI u support (cmux, others)

2 participants