fix(terminal): advertise kitty keyboard protocol for Shift+Enter (#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 <help@stably.ai>
This commit is contained in:
@@ -53,6 +53,16 @@ describe('buildDefaultTerminalOptions', () => {
|
||||
it('leaves macOS Option available for keyboard layout characters', () => {
|
||||
expect(buildDefaultTerminalOptions().macOptionIsMeta).toBe(false)
|
||||
})
|
||||
|
||||
it('advertises kitty keyboard protocol so CLIs enable enhanced key reporting', () => {
|
||||
// Why: Orca already writes CSI-u bytes for extended key chords like
|
||||
// Shift+Enter (see terminal-shortcut-policy.ts). CLIs that gate
|
||||
// enhanced input on a CSI ? u handshake only read those bytes once the
|
||||
// terminal advertises support. Regressing this flag silently breaks
|
||||
// Shift+Enter (and other extended chords) in apps like Claude Code and
|
||||
// Codex, especially when running inside tmux.
|
||||
expect(buildDefaultTerminalOptions().vtExtensions?.kittyKeyboard).toBe(true)
|
||||
})
|
||||
})
|
||||
|
||||
describe('attachWebgl', () => {
|
||||
|
||||
@@ -16,6 +16,16 @@ export function buildDefaultTerminalOptions(): ITerminalOptions {
|
||||
// Why: on macOS, non-US layouts rely on Option to compose characters like @ and €.
|
||||
macOptionIsMeta: false,
|
||||
macOptionClickForcesSelection: true,
|
||||
drawBoldTextInBrightColors: true
|
||||
drawBoldTextInBrightColors: true,
|
||||
// Why: advertise kitty keyboard protocol support so CLIs that probe
|
||||
// (CSI ? u) know Orca accepts enhanced key reporting. Without this,
|
||||
// Orca already writes \x1b[13;2u for Shift+Enter (see
|
||||
// terminal-shortcut-policy.ts), but programs that respect the protocol
|
||||
// handshake fall back to legacy encodings and ignore the CSI-u byte,
|
||||
// making chords like Shift+Enter invisible to the app — especially
|
||||
// noticeable inside tmux. Matches VS Code's xtermTerminal.ts.
|
||||
vtExtensions: {
|
||||
kittyKeyboard: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user