Skip to content

fix(web): copy terminal selection with Ctrl+Insert - #8541

Open
iamshadmantaqi wants to merge 2 commits into
pingdotgg:mainfrom
iamshadmantaqi:fix/terminal-ctrl-insert-copy
Open

fix(web): copy terminal selection with Ctrl+Insert#8541
iamshadmantaqi wants to merge 2 commits into
pingdotgg:mainfrom
iamshadmantaqi:fix/terminal-ctrl-insert-copy

Conversation

@iamshadmantaqi

@iamshadmantaqi iamshadmantaqi commented Aug 28, 2026

Copy link
Copy Markdown

What 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.ts failed with expected false to be true on Ctrl+Insert.
  • After the fix, that file is 44/44 passing.
  • vp lint on 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 for commit c9b54bb. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Add Ctrl+Insert copy shortcut to terminal on non-mac platforms

  • Extends isTerminalCopyShortcut in surface.ts to return true for the Insert key on non-mac platforms when Ctrl is pressed and neither Shift nor Meta are held.
  • Updates the keydown handler so Ctrl+Insert triggers the synthesized copy path (document.execCommand('copy')) and calls preventDefault, matching the existing Ctrl+Shift+C behavior.
  • Risk: macOS ignores Ctrl+Insert, and Shift+Insert / Meta+Insert are not treated as copy on any platform.

Macroscope summarized 3f0b9ca.

@coderabbitai

coderabbitai Bot commented Aug 28, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e9c5b980-a91e-429a-9be2-e5d38a1b3039

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Aug 28, 2026
@macroscopeapp

macroscopeapp Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at c9b54bb

Macroscope'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.

Shift+Insert already pastes. Ctrl+Insert currently falls through because
isTerminalCopyShortcut only matches the C key.
Mirror the Shift+Insert paste branch. Ctrl+Insert is the GTK/VTE copy
chord and the one tiling WMs send for universal clipboard on a terminal
window. Copy only, do not treat it as SIGINT.

Closes pingdotgg#8525
@shivamhwp
shivamhwp force-pushed the fix/terminal-ctrl-insert-copy branch from c9b54bb to 3f0b9ca Compare September 6, 2026 06:15
@cursor

cursor Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Integrated terminal ignores Ctrl+Insert copy, breaking tiling-WM universal-clipboard shortcuts

1 participant