Skip to content

fix(terminal): pass unselected Ctrl+Shift+C through to Kitty TUIs on Linux/Windows - #41442

Merged
nwparker merged 1 commit into
mainfrom
bugbash/fix-9727-linux-kitty-copy
Nov 12, 2026
Merged

nwparker merged 1 commit into
mainfrom
bugbash/fix-9727-linux-kitty-copy

Conversation

@nwparker

@nwparker nwparker commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Extend isAppOwnedCopyChord in xterm-bypass-policy.ts from macOS-only Mod+C to also cover Ctrl+Shift+C on Linux/Windows when there is no xterm selection (!hasSelection) and the running application has negotiated Kitty keyboard flags (kittyKeyboardFlags !== 0).
  • Mouse-capturing Kitty TUIs (Claude Code, Codex, OpenCode, etc.) draw their own selection inside the alternate screen without populating xterm.hasSelection(). Previously on Linux/Windows, shouldBypassXtermKeyboardEvent unconditionally bypassed Ctrl+Shift+C as a native clipboard event, leaving nothing to copy and swallowing the chord before xterm's Kitty encoder could forward CSI-u (\x1b[99;6u / \x1b[99:67;6u) to the TUI across main terminal panes, preview popouts, and SSH terminals.
  • Preserves existing behavior everywhere else:
    • When xterm has a selection (hasSelection: true), Orca still copies xterm's selection and sends nothing to the PTY.
    • When Kitty keyboard reporting is off (kittyKeyboardFlags === 0 in plain shells like bash/zsh/pwsh or legacy apps), unselected Ctrl+Shift+C still bypasses xterm and sends zero bytes to the shell.

Fixes #9727

Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​80 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​80
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​9 $\color{#cf222e}{\Huge{\mathbf{−}}}$​9 0

@coderabbitai

coderabbitai Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The policy now recognizes Cmd+C on macOS and Ctrl+Shift+C on other platforms when there is no selection and Kitty keyboard flags are nonzero. Tests cover selection, Kitty mode, prevented events, keyup, and a mismatched key code.

Severity of issue fixed: Medium

Merge Risk: Minimal · up to b4e7c

This change lets unselected Ctrl+Shift+C reach Kitty-protocol TUIs on Linux and Windows. Existing copy behavior is preserved when text is selected or Kitty mode is off. No actionable merge-blocking risk remains.

Pre-merge checks: Passed 2 · Inconclusive 2

Failed Failed checks: 2 inconclusive

Check name Status Explanation Resolution
Linked Issues check Inconclusive Issue #9727 reports that copy chords do not copy a mouse-capturing TUI selection on macOS. The reviewed head changes isAppOwnedCopyChord in xterm-bypass-policy.ts. On macOS, an unselected Cmd+C with n… Confirm how macOS Ctrl+Shift+C routes when there is no selection and Kitty flags are nonzero. Inspect the terminal.copySelection handling in src/renderer/src/components/terminal-pane/keyboard-handlers.ts for that path. Add or cite a test th…
Out of Scope Changes check Inconclusive The diff has two behavior changes in one function. The macOS change covers the Cmd+C case in #9727. The non-macOS change adds Ctrl+Shift+C pass-through on Linux and Windows when there is no selection … Confirm whether the Linux/Windows Ctrl+Shift+C change is intended under #9727. If it is a separate bug, the author should split it into its own PR or issue. If it is intended, the linked issue text should cover the non-macOS behavior.
Passed Passed checks: 2 passed

Check name Status Explanation
Title check Passed The title names the main change: unselected Ctrl+Shift+C is now passed through to Kitty-enabled TUIs on Linux/Windows. The raw summary and PR description both describe extending isAppOwnedCopyChord to…
Description check Passed The description covers the core change, the mechanism (hasSelection and kittyKeyboardFlags gating), and the preserved behaviors. It explicitly links the issue with 'Fixes #9727'. However, it omits sev…
Full details: Title check

Explanation

The title names the main change: unselected Ctrl+Shift+C is now passed through to Kitty-enabled TUIs on Linux/Windows. The raw summary and PR description both describe extending isAppOwnedCopyChord to cover this chord when there is no selection and Kitty flags are nonzero. The title is specific and matches the changeset. It is 82 characters, which is slightly long but acceptable.

Full details: Description check

Explanation

The description covers the core change, the mechanism (hasSelection and kittyKeyboardFlags gating), and the preserved behaviors. It explicitly links the issue with 'Fixes #9727'. However, it omits several required template sections: ELI5, a Visual Proof section (required for behavior changes, with before/after media or N/A reason), a Risk section with a Level rating and rollback plan, the Testing checklist state, and the Checklist. The description is mostly technical and would be more complete with these sections filled in.

Resolution

Add the missing template sections so reviewers can assess the change. Specifically: (1) an ELI5 summary in plain language; (2) a Visual Proof section with BEFORE and AFTER media for this terminal behavior change, or N/A with a reason; (3) a Testing section listing the platforms actually tested (Linux, Windows, macOS, SSH) and the test steps; (4) a Risk section with a Level (Low, Medium, or High), the riskiest part, and how to revert; (5) a note on whether the AI Disclosure and Agent skill upstream boundary sections apply. Also check the boxes in the Checklist that apply.

Full details: Linked Issues check

Explanation

Issue #9727 reports that copy chords do not copy a mouse-capturing TUI selection on macOS. The reviewed head changes isAppOwnedCopyChord in xterm-bypass-policy.ts. On macOS, an unselected Cmd+C with nonzero kittyKeyboardFlags now returns false from shouldBypassXtermKeyboardEvent. The chord then reaches xterm, which can encode it for the PTY. This matches the issue's suggested fix for Cmd+C, and the added tests cover this case. For macOS Ctrl+Shift+C, the issue's repro also fails. The policy change does not name that chord on macOS. After the bypass returns false, the macOS branch bypasses only Mod+C and Mod+V, so Ctrl+Shift+C is not bypassed. Whether it reaches the PTY depends on the terminal.copySelection binding in keyboard-handlers.ts, which the diff does not change and which was not inspected. The Linux/Windows Ctrl+Shift+C change is not a macOS requirement of #9727. Its behavior is outside the issue's stated platform.

Resolution

Confirm how macOS Ctrl+Shift+C routes when there is no selection and Kitty flags are nonzero. Inspect the terminal.copySelection handling in src/renderer/src/components/terminal-pane/keyboard-handlers.ts for that path. Add or cite a test that covers macOS Ctrl+Shift+C, if the issue requires it.

Full details: Out of Scope Changes check

Explanation

The diff has two behavior changes in one function. The macOS change covers the Cmd+C case in #9727. The non-macOS change adds Ctrl+Shift+C pass-through on Linux and Windows when there is no selection and Kitty flags are nonzero. Issue #9727 is scoped to macOS and does not request this platform change. The PR description links the change to #9727 and calls it a Linux/Windows fix for the same class of TUI copy problem. The change is related to the feature, so it is not clearly unrelated. The tests cover the non-macOS case, and the non-selection and disabled-Kitty cases remain bypassed as before. Whether the non-macOS change belongs in #9727 cannot be decided from the issue text.

Resolution

Confirm whether the Linux/Windows Ctrl+Shift+C change is intended under #9727. If it is a separate bug, the author should split it into its own PR or issue. If it is intended, the linked issue text should cover the non-macOS behavior.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d2a77775-9671-45c7-a7e1-123cbd8aca04
Commits

Reviewing files that changed from the base of the PR and between 4dcf689 and b4e7ce4.

Files selected for processing: 2

  • src/renderer/src/components/terminal-pane/input/keyboard/xterm-bypass-policy.test.ts
  • src/renderer/src/components/terminal-pane/input/keyboard/xterm-bypass-policy.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@nwparker
nwparker merged commit 10c91a3 into main Nov 12, 2026
48 checks passed
@nwparker
nwparker deleted the bugbash/fix-9727-linux-kitty-copy branch November 12, 2026 07:48
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.

[Bug]: macOS — Cmd+C / Ctrl+Shift+C don't copy selection inside mouse-capturing TUIs (Claude Code, etc.); only plain Ctrl+C works

1 participant