orca/docs/terminal-shortcuts.md
brennanb2025 9e8375708f refactor(terminal): harden shortcut docs test + fix e2e selection order
- docs test: throw on malformed entries in formatKeyLabel instead of
  emitting '?' placeholder that would silently ship a broken doc; add
  guard assertion that every entry applies to at least one platform;
  add direct test of the throw path.
- e2e copy-selection: focus the terminal BEFORE programmatic selectAll
  so the xterm helper-textarea focus event cannot collapse the selection
  before the chord is sent.
- docs: clarify regeneration instructions and mark the reserved-chords
  section as editorial (not enforced by the parity test). Rewrote the
  opening sentence so it no longer contains a literal BEGIN:MAC marker
  string that collided with the parity test's indexOf scan.
2026-04-19 23:36:25 -07:00

4.1 KiB

Terminal Shortcuts

This document is generated from src/renderer/src/components/terminal-pane/terminal-shortcut-table.ts and is enforced by terminal-shortcut-table.docs.test.ts. If the table changes, this file must be regenerated: run the parity test in terminal-shortcut-table.docs.test.ts, then replace the rows inside the BEGIN:MAC/END:MAC and BEGIN:NONMAC/END:NONMAC HTML-comment markers below with the expected value from the assertion diff.

Notation:

  • Mod = Cmd on macOS, Ctrl on Windows/Linux
  • Ctrl / Meta / Alt / Shift are literal modifier keys
  • → sendInput(X) means we write bytes X to the PTY
  • → <action> means we fire an app-level action

Shortcuts that depend on the Mac "Option as Alt" setting (Option+letter composing vs. Esc+letter emitting) are not in this table — they live in resolveMacOptionAsAltAction because their matching depends on runtime state.

Mac (macOS)

Chord Action

| Mod+Shift+C | Copy terminal selection | | Mod+F | Toggle terminal search overlay | | Mod+K | Clear active pane screen and scrollback | | Mod+W | Close active split pane (or the tab if only one pane) | | Mod+] | Cycle focus to next split pane | | Mod+[ | Cycle focus to previous split pane | | Mod+Shift+Enter | Expand/collapse active split pane to fill the terminal area | | Mod+Shift+D | Split active pane downward (Mac) | | Mod+D | Split active pane to the right (Mac) | | Mod+ArrowLeft | → sendInput(Ctrl+A) — Move cursor to start of line (Ctrl+A) | | Mod+ArrowRight | → sendInput(Ctrl+E) — Move cursor to end of line (Ctrl+E) | | Mod+Backspace | → sendInput(Ctrl+U) — Kill from cursor to start of line (Ctrl+U) | | Mod+Delete | → sendInput(Ctrl+K) — Kill from cursor to end of line (Ctrl+K) | | Alt+ArrowLeft | → sendInput(\eb) — Move cursor backward one word (\eb) | | Alt+ArrowRight | → sendInput(\ef) — Move cursor forward one word (\ef) | | Alt+Backspace | → sendInput(Esc+DEL) — Delete word before cursor (Esc+DEL) | | Ctrl+Backspace | → sendInput(\x17) — Delete word before cursor (unix-word-rubout \x17) | | Shift+Enter | → sendInput(\e[13;2u) — Shift+Enter as CSI-u (\e[13;2u) so agents can distinguish from Enter |

Windows / Linux

Chord Action

| Mod+Shift+C | Copy terminal selection | | Mod+F | Toggle terminal search overlay | | Mod+K | Clear active pane screen and scrollback | | Mod+W | Close active split pane (or the tab if only one pane) | | Mod+] | Cycle focus to next split pane | | Mod+[ | Cycle focus to previous split pane | | Mod+Shift+Enter | Expand/collapse active split pane to fill the terminal area | | Mod+Shift+D | Split active pane to the right (Linux/Windows) | | Alt+Shift+D | Split active pane downward (Linux/Windows, Windows Terminal convention) | | Alt+ArrowLeft | → sendInput(\eb) — Move cursor backward one word (\eb) | | Alt+ArrowRight | → sendInput(\ef) — Move cursor forward one word (\ef) | | Alt+Backspace | → sendInput(Esc+DEL) — Delete word before cursor (Esc+DEL) | | Ctrl+Backspace | → sendInput(\x17) — Delete word before cursor (unix-word-rubout \x17) | | Shift+Enter | → sendInput(\e[13;2u) — Shift+Enter as CSI-u (\e[13;2u) so agents can distinguish from Enter |

Reserved shell chords (never intercepted)

(This section is editorial and is not enforced by the parity test — it describes chords intentionally left out of the table.)

These fall through to xterm.js and the shell regardless of platform:

  • Ctrl+C — SIGINT
  • Ctrl+D — EOF (see #586 — this is why our non-Mac split chord requires Shift)
  • Ctrl+Z — SIGTSTP
  • Ctrl+\ — SIGQUIT
  • Home / End — start/end of line (xterm's terminfo sequences)
  • Ctrl+R / Ctrl+U / Ctrl+A / Ctrl+E — readline

Note: on Linux/Windows, Ctrl+K and Ctrl+W ARE intercepted by the app (they are Mod+K / Mod+W — see the Windows/Linux table above). On macOS, Mod is Cmd, so Ctrl+K and Ctrl+W fall through to readline there.