[Bug]: macOS — Cmd+C / Ctrl+Shift+C don't copy selection inside mouse-capturing TUIs (Claude Code, etc.); only plain Ctrl+C works
- Dominant language
- TypeScript
- Stars
- 69.7k
- Forks
- 4.5k
- Avg merge
- 15h 28m
- Merged PRs (30d)
- 471
Description
## Summary
On macOS, inside a fullscreen TUI that enables mouse tracking (Claude Code, OpenCode, etc.),
drag-selecting text and pressing **Cmd+C** (or **Ctrl+Shift+C**) copies nothing.
Only **plain Ctrl+C** copies the selection. Cmd+C works fine for normal shell output
(non-TUI), so the problem is specific to TUIs that own the mouse.
## Repro
1. macOS, Orca terminal (v1.4.142).
2. Run a TUI that captures the mouse, e.g. `claude`.
3. Drag-select text inside the TUI (Claude Code shows its own "copied N chars to clipboard" on copy).
4. Press **Cmd+C** → nothing copied. Press **Ctrl+Shift+C** → nothing copied.
5. Press **plain Ctrl+C** → selection is copied. ✅
## Root cause (from source)
- `Cmd+C` / `Ctrl+Shift+C` are bound to the `terminal.copySelection` action, which copies
xterm's **native** selection via `pane.terminal.getSelection()` and returns early when it is empty:
- `src/renderer/src/components/terminal-pane/keyboard-handlers.ts:440-457` (`if (!selection) return`)
- Inside a mouse-capturing TUI, the drag never produces an xterm native selection (the TUI owns
the mouse and renders its own selection), so `getSelection()` is empty → `copySelection` is a no-op.
- Plain `Ctrl+C` works because it is routed to the PTY as ETX instead of `copySelection`, and the
CLI performs its own copy-on-selection:
- `src/renderer/src/components/terminal-pane/use-terminal-pane-lifecycle.ts:914-931`
- `src/renderer/src/components/terminal-pane/xterm-bypass-policy.ts:181-194`
- On macOS, `Cmd+C` / `Cmd+V` are also bypassed to the native copy path:
- `src/renderer/src/components/terminal-pane/xterm-bypass-policy.ts:248-256`
## Suggested fix
When the active pane's app owns the selection (mouse tracking / kitty keyboard protocol enabled)
and xterm's native `getSelection()` is empty, forward the copy chord to the PTY (like the plain
Ctrl+C path) instead of no-op'ing, so the CLI's own copy runs. This makes Cmd+C behave like the
working plain Ctrl+C inside TUIs, while keeping native copy for plain (non-TUI) shell selections.
## Environment
- Orca 1.4.142
- macOS
- TUI: Claude Code (likely affects any mouse-capturing TUI: OpenCode, etc.)
Contributor guide
Assessment
This issue has not been assessed yet.