Repository navigation
Conversation
Contributor
|
Thanks @dyc3 for the PR. This repo needs approval before a PR. Join the #contributors channel in Discord (https://discord.gg/kvBU6tJhcJ) and explain what you want to open a PR for and why. A maintainer then adds you to the allow list. This PR now closes on its own. Reopen it or open a new one after approval. |
xterm.js has no copy shortcut of its own. It copies only through the browser's native copy event, which Cmd+C fires on macOS. On Linux and Windows the native shortcut is Ctrl+C, which the terminal sends as an interrupt, and Ctrl+Shift+C reaches nothing. Ctrl+Shift+V already pastes through the native paste event, so only Ctrl+Shift+C needs handling. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Collaborator
|
/approve @dyc3 |
Contributor
|
Approved @dyc3 for PRs. The name now stays on the allow list. The author can open a PR now. |
ymichael
marked this pull request as ready for review
October 14, 2026 22:59
dyc3
deleted the
dyc3/fix-it-so-that-copy-and-paste-works-in-terminal-thr_nfdz2rvy64
branch
October 14, 2026 23:07
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Human comments
Paste already works. Copying text out of the terminal is the issue.
I'm not too good with react, so I don't really know if the clanker got this right. It's an issue I encounter regularly, and I figured I'd send a PR for it.
I had my other clanker test it on a mac with computer use.
What was wrong
xterm.js has no copy keyboard shortcut of its own. It copies only when the browser fires a native
copyevent, which it then fills with the terminal selection (CoreBrowserTerminal'scopylistener). On macOS, Cmd+C fires that event, so copying already worked. On Linux and Windows the native copy key is Ctrl+C, which xterm sends to the shell as an interrupt and cancels, and Ctrl+Shift+C, the usual terminal copy key, reaches nothing: xterm's Ctrl+letter mapping skips Shift, and Chrome treats it as the DevTools inspector shortcut. So the terminal had no way to copy from the keyboard there. Ctrl+Shift+V already pasted through the nativepasteevent. See #3341.What changed
apps/app/src/components/thread/terminal/terminal-copy-shortcut.ts(new): an xterm custom key handler for Ctrl+Shift+C. It copies the terminal selection through the existingcopyToClipboardWithToasthelper, silently on success and with "Failed to copy" on error, and claims the key (prevents default and stops propagation) so the browser and app shortcuts don't also act on it. With no selection it does nothing. The key is matched bykey, falling back tocodeon non-Latin layouts.ThreadTerminalView.tsxattaches the handler when the terminal mounts, on every platform. On macOS, Ctrl+Shift+C previously did nothing, and Cmd+C never reaches the handler, so it keeps using the browser's native copy.Compared with the first revision of this PR, the handler no longer takes over Cmd+C on macOS or the paste chords, since both already worked natively.
No wire, CLI, or documentation changes.
How you verified
terminal-copy-shortcut.test.tsdispatches key events at a real xterm instance: Ctrl+Shift+C copies the selection on Latin and non-Latin layouts without sending input, an empty selection copies nothing, and Ctrl+C with a selection still sends\x03. With the handler removed, the copy tests fail.pnpm exec turbo run test --filter=@bb/app -- src/components/thread/terminal: 8 files, 53 tests pass.pnpm exec turbo run typecheck lint --filter=@bb/app: 0 errors.pnpm start:worktreebuild driven in Chromium on macOS against a live zsh terminal, selecting echoed output and reading the clipboard:copyevent, as on main; Ctrl+Shift+C also copied; Cmd+V pasted once.sleep 300(exit 130) and left the clipboard unchanged.Fixes #3341
🤖 Generated with Claude Code