fix(web): copy terminal selection with Ctrl+Insert #8541
main fromrefs/pull/8541/head·merged by shivamhwp(GitHub profile, opens in a new tab) View on GitHubWhat Changed#
isTerminalCopyShortcut now treats Ctrl+Insert as copy on non-mac platforms, matching the existing Shift+Insert paste branch. The keydown handler copies with execCommand("copy") the same way it does for Ctrl+Shift+C, so the chord does not go to the PTY and is not treated as SIGINT.
Why#
Tiling WMs such as Omarchy map universal copy on a terminal window to Ctrl+Insert. Paste already worked because #5982 added Shift+Insert. Copy still required key === "c", so the selection never reached the clipboard.
Ctrl+Insert is also the usual GTK/VTE copy chord.
Closes #8525
Blast Radius#
Web and desktop share GhosttyTerminalSurface. Mobile does not use this helper.
Ctrl+C and Ctrl+Shift+C are unchanged. macOS still ignores Insert for this shortcut.
Verification#
Failing-then-passing regression in apps/web/src/terminal/ghostty/surface.test.ts.
- Before the fix,
vp test run apps/web/src/terminal/ghostty/surface.test.tsfailed withexpected false to be trueonCtrl+Insert. - After the fix, that file is 44/44 passing.
vp linton the two changed files: 0 errors.vp run --filter @t3tools/web typecheck: clean.
No UI chrome changed, so no screenshots.
Checklist#
- This PR is small and focused
- I explained what changed and why
- No UI change (screenshots not applicable)
- No motion change (video not applicable)
Note
Low Risk Scoped keyboard shortcut and clipboard copy path in the Ghostty terminal surface; existing Ctrl+C and macOS behavior stay unchanged.
Overview Non-mac Ghostty terminal copy now treats Ctrl+Insert like other copy chords when text is selected, alongside existing Ctrl+C / Cmd+C behavior.
isTerminalCopyShortcut adds an Insert branch (Ctrl, no Shift/Meta) on non-mac platforms, mirroring how Shift+Insert is handled for paste. The surface keydown path runs execCommand("copy") for Insert as well as Ctrl+Shift+C, because the browser does not fire a native copy event for those chords—so the selection is primed and copied without sending the key to the PTY or triggering SIGINT semantics tied to plain Ctrl+C.
Regression tests cover Linux acceptance and macOS rejection of Ctrl+Insert.
Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit c9b54bb6c899677d47075ce376b60ecb71356d19. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).Note
Add Ctrl+Insert copy shortcut to terminal on non-mac platforms#
- Extends
isTerminalCopyShortcutin surface.ts to return true for theInsertkey on non-mac platforms whenCtrlis pressed and neitherShiftnorMetaare held. - Updates the
keydownhandler soCtrl+Inserttriggers the synthesized copy path (document.execCommand('copy')) and callspreventDefault, matching the existingCtrl+Shift+Cbehavior. - Risk: macOS ignores
Ctrl+Insert, andShift+Insert/Meta+Insertare not treated as copy on any platform.
Summary by CodeRabbit#
New Features
- Added support for the conventional Ctrl+Insert shortcut to copy terminal content on non-macOS platforms.
- The shortcut works alongside existing copy shortcuts, providing an alternative way to copy selected terminal text.
Bug Fixes
- Ensured Ctrl+Insert triggers clipboard copying correctly while preserving platform-specific shortcut behavior, including the expected behavior on macOS and for related Insert key combinations.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
Approvability#
Verdict: Approved at
c9b54bbMacroscope's review found this PR approvable — This is a narrowly scoped terminal shortcut fix: non-macOS Ctrl+Insert now copies an existing selection through the established copy path, while existing shortcuts and macOS behavior remain unchanged. Regression tests cover the new and excluded cases, with no schema, infrastructure, or sensitive-area changes.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).Bugbot is paused — on-demand spend limit reached
Bugbot uses usage-based billing for this team and has hit its on-demand spend limit.
A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue.
Bugbot is paused — on-demand spend limit reached
Bugbot uses usage-based billing for this team and has hit its on-demand spend limit.
A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue.
Windows review of
a6b41c0177fbb25e793dd8284def7d31dee090f4, compared with6df0add6e65b7c0040b5774635f794e4ff802ddd.No blocking defect found in the Ctrl+Insert change. All 49 focused surface tests pass, as do format/lint for the two changed files and the web typecheck. Bun is absent on this machine; I used the checkout's pinned Vite+ 0.3.0 tooling and scoped checks.
In the real T3 app on Windows build 26200 / Chrome 152, a synthetic Ctrl+Insert keydown ran the terminal handler, emitted a trusted copy event through execCommand, and copied the selected text to the Windows OS clipboard. Repeated copy retained the selection. Without a selection, the clipboard stayed unchanged. Ctrl+Shift+C also copied; the Ctrl+C and Shift+Insert clipboard fallback checks behaved as expected within the browser bridge.
This is a comment rather than approval because physical-key and Electron testing remain incomplete. The browser shortcut tool substitutes a copy event for Ctrl+Insert, so its initial apparent success was discarded as keydown evidence. Please do a physical-key smoke test in Windows Chrome and Electron before treating this as a complete Windows sign-off.
- P2, baseline only: closing the test terminal removed it from the UI but left its shell running.
Manager.ts:1620sends SIGTERM throughNodePtyAdapter.ts:90; node-pty rejects signals on Windows. I reproduced the dependency behavior separately and verified those files and the lockfile are unchanged from the base. This belongs in separate work and is not a blocker for this PR. Owned test processes were cleaned up.
Windows review report · Evidence and reproduction bundle
Reviewed by GPT-6 through Codex.
- P2, baseline only: closing the test terminal removed it from the UI but left its shell running.
Note
GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.
shivamhwp(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Advanced
Run ID:
97812a7e-06c3-41eb-9a79-3e592cfcc819📥 Commits
Reviewing files that changed from the base of the PR and between d6dbe8dd67facf4a43030993bebb58cc7e7ac141 and b0b9776db3e3ef8c523b77898f18267f21237ba3.
📒 Files selected for processing (2)
apps/web/src/terminal/ghostty/surface.test.tsapps/web/src/terminal/ghostty/surface.ts🚧 Files skipped from review as they are similar to previous changes (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
📝 Walkthrough
Walkthrough#
The terminal recognizes Ctrl+Insert as a copy shortcut on non-macOS platforms. The keydown handler synthesizes the copy command, and tests cover supported and rejected key combinations.
Changes#
Terminal copy shortcut
apps/web/src/terminal/ghostty/surface.ts,apps/web/src/terminal/ghostty/surface.test.tsisTerminalCopyShortcutaccepts Ctrl+Insert on non-macOS platforms. Tests cover valid and invalid modifier and platform combinations.apps/web/src/terminal/ghostty/surface.tsonKeyDowninvokesexecCommand("copy")for Ctrl+Insert because the shortcut does not produce a native copy event.Priority: ➖ Normal — Impact reflects medium issue severity.
Estimated code review effort: 2 (Simple) | ~10 minutes
Severity of issue fixed: Medium
Merge Risk: ⚪ Minimal · up to
b0b97Terminal users on non-macOS platforms can copy selected text with Ctrl+Insert without sending the chord to the PTY, while existing macOS behavior remains unchanged. No current merge-readiness risk remains.
Suggested reviewers:
sunkenintime🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)#
✅ Passed checks (4 passed)
#8525] by recognizing Ctrl+Insert on non-macOS platforms, copying with execCommand("copy"), preventing PTY delivery, preserving macOS behavior, and adding regression coverag…✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment `@coderabbitai help` to get the list of available commands.