[VS Code Shell] Fix CTRL/CMD + C Copy#2714
Merged
Merged
Conversation
The message input is a display:inline contentEditable span, so its flex wrapper is wider than the text run. A press in that empty padding landed on the wrapper (not the editable), so a selection couldn't begin there - you could only select by starting the drag on the text itself. Forward padding presses to the editable via pointer capture: focus it, anchor a caret at the pointer, and extend the selection as the pointer moves, so the whole box up to the buttons is drag-selectable. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 679cef00-4867-4bba-8efe-3daac6103863
…ft/TypeAgent into dev/georgeng/vscode_copy
Extract fireInputEvent() helper for the three identical programmatic 'input' event dispatches in contextMenu.ts, and remove the unused isCopy local in handleClipboardShortcut (it only fed the guard). No behavior change. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 679cef00-4867-4bba-8efe-3daac6103863
GeorgeNgMsft
marked this pull request as ready for review
July 21, 2026 19:50
GeorgeNgMsft
enabled auto-merge
July 21, 2026 20:06
datduyng
approved these changes
Jul 21, 2026
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.
Fix copy/paste in the VS Code shell chat
Text in the TypeAgent VS Code chat couldn't be copied with the keyboard, and the message input was awkward to select. This fixes both. Changes live in the shared chat-ui package (wired up from the VS Code webview); the Electron shell is unaffected.
What changed
Keyboard copy / cut works everywhere in the chat
• Problem: In the VS Code chat, Ctrl/Cmd+C (and Ctrl/Cmd+X ) did nothing on selected text — only the right-click menu copied. VS Code webviews don't run the native clipboard action on a DOM selection; only the JS clipboard path works.
• Fix: Added handleClipboardShortcut in chat-ui (reusing the same navigator.clipboard path the right-click menu already uses) and wired it from a keydown listener in the VS Code webview. Copy now works across the chat history and the message input; cut works in editable fields. Covers plain text selections and native / <textarea> selections.
• Electron keeps its native clipboard keys, so it's left untouched.
Message input is fully drag-selectable
• Problem: The input is a display: inline contentEditable span, so its box is wider than the text. Starting a drag anywhere except directly on the text landed on the padding and selected nothing.
• Fix: Rewrote the input's press handling to use pointer capture with geometry-clamped caret mapping, so you can start a selection anywhere in the input box (up to the buttons) and drag to select — with clean anchor/extend behavior.