fix(terminal): stop Ctrl+Shift+V pasting twice - #2728
Merged
bajrangCoder merged 1 commit intoAug 13, 2026
Conversation
xterm.js calls attachCustomKeyEventHandler on both keydown and keyup, but the handler didn't check event.type, so paste/copy/font-zoom ran twice per keypress. Gate the side-effecting calls to keydown only.
Contributor
Greptile SummaryThis PR prevents terminal keyboard shortcuts from executing twice by running copy, paste, font-zoom, and application-keybinding actions only during
Confidence Score: 5/5The PR appears safe to merge, with no concrete blocking or independently actionable issue identified. The changed handler executes each shortcut action once on keydown and continues suppressing matching events, addressing the duplicate copy, paste, zoom, and application-command behavior without an established regression. Important Files Changed
Reviews (1): Last reviewed commit: "fix(terminal): stop Ctrl+Shift+V pasting..." | Re-trigger Greptile |
Contributor
Author
|
Thanks for your support, Mr. Bot. |
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.
Trying to paste with a physical keyboard using Ctrl+Shift+V in the built-in terminal pastes the clipboard content twice. Copy and font-zoom (Ctrl+/-) have the same issue.
Cause:
terminal.js'ssetupCopyPasteHandlersuses xterm.js'sattachCustomKeyEventHandler, which fires on bothkeydownandkeyup. The handler never checkedevent.type, sopasteFromClipboard()/copySelection()/ font-zoom ran once per phase — twice per keypress.Fix: only invoke the action on
keydown; stillpreventDefault()/swallow the event on both phases so nothing leaks through to default handling.Verification: Works On My Machine™