Skip to content

fix(tmux): set extended-keys per-session to avoid breaking dashboard Ctrl shortcuts#373

Closed
rhukster wants to merge 1 commit intoasheshgoplani:mainfrom
rhukster:fix/extended-keys-per-session
Closed

fix(tmux): set extended-keys per-session to avoid breaking dashboard Ctrl shortcuts#373
rhukster wants to merge 1 commit intoasheshgoplani:mainfrom
rhukster:fix/extended-keys-per-session

Conversation

@rhukster
Copy link
Copy Markdown
Contributor

Summary

  • tmux.go: Changed set -sq extended-keys on (server-wide) to set-option -t <session> -q extended-keys on (per-session) at both call sites (Start() and EnableMouseMode())
  • keyboard_compat.go: Added xterm modifyOtherKeys disable sequence (ESC[>4;0m) on TUI startup as defense-in-depth, alongside the existing Kitty protocol disable
  • Tests: Updated DisableKittyKeyboard/RestoreKittyKeyboard tests, added Ctrl+R recent picker tests

Problem

The extended-keys on option introduced in b427418 (#342) was set with -s (server-wide), which caused tmux to activate xterm modifyOtherKeys mode on the outer terminal (iTerm2, etc.). This mode persists even after the tmux option is turned off, causing modified keys like Ctrl+R to be sent as escape sequences (\x1b[27;5;114~) instead of legacy bytes (0x12). Bubble Tea v1.3.10 cannot parse these sequences, breaking:

  • Ctrl+R recent sessions picker in the new session dialog
  • Potentially all other Ctrl-key shortcuts in the dashboard

Root Cause

set -sq extended-keys on is a server-level setting that affects all sessions on the tmux server, including the dashboard's terminal. When any child session starts, tmux negotiates modifyOtherKeys mode 2 with the outer terminal — and this terminal state persists independently of tmux's own setting.

Fix

  1. Scope extended-keys per-session so only child sessions (where Shift+Enter is needed) get it, not the dashboard
  2. Send \x1b[>4;0m on TUI startup to reset the terminal in case it was previously poisoned

Test plan

  • Existing tmux tests pass
  • TestDisableKittyKeyboard / TestRestoreKittyKeyboard updated and pass
  • New TestNewDialog_CtrlR_OpensRecentPicker / TestNewDialog_CtrlR_HintHiddenWhenNoRecents pass
  • Manual: Ctrl+R opens recent sessions picker in new session dialog
  • Manual: Shift+Enter still works inside attached Claude Code sessions

…key input

The extended-keys option was set server-wide (`set -sq`), which caused
tmux to activate xterm modifyOtherKeys mode on the outer terminal
(iTerm2, etc.). This persisted even after the tmux option was turned off,
causing Ctrl+R and other modified keys to be sent as escape sequences
that Bubble Tea cannot parse — breaking the recent sessions picker and
other Ctrl-key shortcuts in the dashboard.

Two fixes:
- tmux.go: changed `set -sq extended-keys on` to per-session
  `set-option -t <session> -q extended-keys on` at both call sites
- keyboard_compat.go: also disable xterm modifyOtherKeys (ESC[>4;0m)
  on TUI startup alongside the existing Kitty protocol disable, as a
  defense-in-depth measure

Fixes regression introduced in b427418 (asheshgoplani#342).
asheshgoplani added a commit that referenced this pull request Mar 18, 2026
@asheshgoplani
Copy link
Copy Markdown
Owner

Merged to main manually (rebased and conflict-resolved). The extended-keys option is now set per-session instead of server-wide. Thank you for the fix!

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.

2 participants