Skip to content

fix: forward OSC 52 copies to the browser clipboard - #8061

Open
yasir-erkam wants to merge 2 commits into
coder:mainfrom
yasir-erkam:fix/terminal-osc52-web-clipboard
Open

yasir-erkam wants to merge 2 commits into
coder:mainfrom
yasir-erkam:fix/terminal-osc52-web-clipboard

Conversation

@yasir-erkam

Copy link
Copy Markdown

OSC 52 copy requests from terminal applications can report success while leaving the browser clipboard unchanged. The terminal provider explicitly passes clipboard, but BrowserClipboardService routes explicitly typed writes into an internal map instead of calling the browser clipboard API.

Add a VS Code patch that uses the default clipboard destination for normal OSC 52 writes. PRIMARY selection and clipboard reads stay unchanged. This fixes copying in fullscreen CLI applications without changing their display settings.

Related upstream issue: microsoft/vscode#318254. Existing upstream fixes microsoft/vscode#318255 and microsoft/vscode#334287 remain open; this patch covers the write path while those fixes are pending.

Reproduce by seeding the clipboard, running this in the integrated terminal, then pasting into an editor:

printf '\033]52;c;Q0xJUEJPQVJEX1RFU1Q=\007'

Before: the previous clipboard value remains. After: CLIPBOARD_TEST is pasted.

Validation:

  • Patch applies to the VS Code commit pinned by current main; TypeScript syntax and patch whitespace checks passed.
  • Six isolated checks pass with the fix, including PRIMARY separation, unchanged reads and the browser-write fallback. Four of those fail on the unmodified source.
  • The equivalent bundle fix was verified interactively in code-server 4.140.0 / VS Code 1.140.0 with Codex CLI 0.162.1, after confirming the browser loaded the modified bundle rather than a stale CDN copy. Normal fullscreen selection and Ctrl+C work.
  • Adds four destination-mapping tests and a Playwright terminal-to-browser clipboard test. The full VS Code and Playwright suites were not run locally; CI validation is still needed.

@yasir-erkam
yasir-erkam requested a review from a team as a code owner October 16, 2026 19:04

This branch has not been deployed

No deployments
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.

1 participant