Skip to content

fix(terminal): advertise kitty keyboard protocol for Shift+Enter - #1247

Merged
nwparker merged 1 commit into
mainfrom
nwparker/tmux-toggle
Apr 29, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/tmux-toggle

Conversation

@nwparker

@nwparker nwparker commented Apr 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Enable vtExtensions.kittyKeyboard on xterm so CLIs that probe with CSI ? u learn Orca speaks the kitty keyboard protocol and actually consume the CSI‑u bytes Orca already emits for chords like Shift+Enter.
  • Matches VS Code's configuration in xtermTerminal.ts.
  • Adds docs/terminal-extended-keys.md covering both the Orca side and the tmux-side config (set -s extended-keys on + terminal-features xterm*:extkeys) users need so Shift+Enter reaches a CLI running inside tmux.
  • Pins the flag with a regression test in pane-lifecycle.test.ts.

Why

terminal-shortcut-policy.ts already writes \x1b[13;2u for Shift+Enter. Without the kittyKeyboard VT extension, xterm.js never answers the protocol handshake, so apps that gate enhanced input on that response (Claude Code, Codex, and similar) fall back to legacy encodings and treat Shift+Enter as plain Enter. The symptom is most visible inside tmux, which also strips extended-key encodings unless explicitly told to forward them.

Test plan

  • pnpm lint
  • pnpm tc:web
  • pnpm vitest run src/renderer/src/lib/pane-manager src/renderer/src/components/terminal-pane — 24 files, 192 tests passing
  • Manual: launched Orca dev, ran cat -v, pressed Shift+Enter, verified ^[[13;2u rendered (caret notation for \x1b[13;2u)
  • Manual: printf '\e[?u' in the terminal elicited the expected CSI ? 0 u reply from xterm.js (confirms the protocol handshake now works)

Unrelated: does not modify the headless emulator in src/main/daemon/headless-emulator.ts; that parser intentionally does not respond to terminal queries (see the existing comment there about OSC 11 double-reply races).

Made with Orca 🐋

Orca's terminal already encodes Shift+Enter as the kitty CSI-u sequence
`\x1b[13;2u`, but without `vtExtensions.kittyKeyboard` xterm.js never
answers the `CSI ? u` probe. CLIs that gate enhanced input on that
handshake (Claude Code, Codex, etc.) therefore drop the extended bytes
and treat Shift+Enter as a plain Enter — most visibly when running
inside tmux, which strips extended-key encodings by default.

- Enable `vtExtensions.kittyKeyboard` in the default terminal options
  (matches VS Code's xtermTerminal).
- Lock in the flag with a regression test in pane-lifecycle.test.ts.
- Add docs/terminal-extended-keys.md explaining the Orca side and the
  tmux-side `set -s extended-keys on` + `terminal-features xterm*:extkeys`
  users need for nested Shift+Enter to reach a CLI.

Verified end-to-end in Electron: `cat -v` + Shift+Enter now prints
`^[[13;2u`, and `printf '\e[?u'` elicits the expected `CSI ? 0 u` reply
from xterm.js.

Co-authored-by: Orca <[email protected]>
@nwparker
nwparker merged commit eb92ba9 into main Apr 29, 2026
3 checks passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…blyai#1247)

Orca's terminal already encodes Shift+Enter as the kitty CSI-u sequence
`\x1b[13;2u`, but without `vtExtensions.kittyKeyboard` xterm.js never
answers the `CSI ? u` probe. CLIs that gate enhanced input on that
handshake (Claude Code, Codex, etc.) therefore drop the extended bytes
and treat Shift+Enter as a plain Enter — most visibly when running
inside tmux, which strips extended-key encodings by default.

- Enable `vtExtensions.kittyKeyboard` in the default terminal options
  (matches VS Code's xtermTerminal).
- Lock in the flag with a regression test in pane-lifecycle.test.ts.
- Add docs/terminal-extended-keys.md explaining the Orca side and the
  tmux-side `set -s extended-keys on` + `terminal-features xterm*:extkeys`
  users need for nested Shift+Enter to reach a CLI.

Verified end-to-end in Electron: `cat -v` + Shift+Enter now prints
`^[[13;2u`, and `printf '\e[?u'` elicits the expected `CSI ? 0 u` reply
from xterm.js.

Co-authored-by: Orca <[email protected]>
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.

1 participant