Skip to content

fix(terminal): restore CTRL+V paste on Windows and context menus - #6272

Open
WarheadTaylor wants to merge 2 commits into
pingdotgg:mainfrom
WarheadTaylor:t3code/fix-terminal-clipboard-paste
Open

fix(terminal): restore CTRL+V paste on Windows and context menus#6272
WarheadTaylor wants to merge 2 commits into
pingdotgg:mainfrom
WarheadTaylor:t3code/fix-terminal-clipboard-paste

Conversation

@WarheadTaylor

@WarheadTaylor WarheadTaylor commented Aug 12, 2026

Copy link
Copy Markdown

What Changed

  • Enable native Paste for terminals via context menu
  • Support Ctrl+V on Windows

Why

CTRL+Shift+V worked on Windows, but it wasn't surfaced to the user that it was the expected input for pasting. This PR expands the different methods available.

Checklist

  • This PR is small and focused
  • I explained what changed and why

Note

Low Risk
Input/UX paste handling only; no auth, security, or data-path changes.

Overview
Makes terminal paste work via Ctrl+V on Windows and via the native/Electron context menu.

isTerminalPasteShortcut now accepts both Ctrl+V and Ctrl+Shift+V on Windows; Linux stays Ctrl+Shift+V-only and macOS stays Cmd+V.

On right-click, the hidden textarea is briefly moved under the cursor and focused so Paste targets the terminal input, then restored. The desktop Electron menu also enables Paste over canvas elements, since Electron treats the terminal canvas as non-editable.

Reviewed by Cursor Bugbot for commit 3dae294. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Fix CTRL+V paste in the terminal on Windows and in context menus

  • On Windows, isTerminalPasteShortcut in surface.ts now treats both Ctrl+V and Ctrl+Shift+V as paste shortcuts; Linux keeps only Ctrl+Shift+V; macOS keeps Cmd+V.
  • When the context menu opens on the terminal canvas, the hidden textarea is temporarily repositioned under the cursor and focused so that the native/Electron "Paste" menu item correctly targets the terminal. Styles are restored on the next tick.
  • The context-menu Paste item in DesktopWindow.ts is now enabled when params.mediaType is "canvas", not just when editFlags.canPaste is true.
  • When terminal mouse reporting is active, context menu handling stops after preventDefault to avoid unintended textarea repositioning.

Macroscope summarized 3dae294.

- Enable native Paste for canvas terminals
- Support Ctrl+V on Windows and position the hidden input for context menus
@coderabbitai

coderabbitai Bot commented Aug 12, 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: c4e5287e-1aa5-40c3-8d2c-d56971291da8

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

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

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:M 30-99 changed lines (additions + deletions). labels Aug 12, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cf0073ef03

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +1324 to +1326
const bounds = this.mount.getBoundingClientRect();
const left = event.clientX - bounds.left - CONTEXT_MENU_INPUT_SIZE / 2;
const top = event.clientY - bounds.top - CONTEXT_MENU_INPUT_SIZE / 2;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Implement context-menu paste for browser clients

In the web and locally hosted browser clients, the native context menu remains associated with the canvas that received this contextmenu event; moving and focusing a textarea after dispatch does not change that event target or its non-editable menu state. Unlike desktop, where DesktopWindow.ts explicitly enables Electron's Paste role for canvases, these clients will therefore still show Paste as unavailable. Use a renderer-owned context-menu action or another clipboard path that does not depend on changing the hit-tested element after the event.

AGENTS.md reference: AGENTS.md:L67-L70

Useful? React with 👍 / 👎.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit cf0073e. Configure here.

Comment thread apps/web/src/terminal/ghostty/surface.ts
@macroscopeapp

macroscopeapp Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

This bug fix modifies runtime paste behavior and DOM manipulation for context menus. An open review comment raises a valid concern that the fix may only work for Electron/desktop, not browser clients - this incomplete coverage warrants human review to confirm the scope is intentional.

You can customize Macroscope's approvability policy. Learn more.

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

Labels

size:M 30-99 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.

1 participant