feat(editor): add snippet paste dialog (alt+v)#3133
Open
EduardF1 wants to merge 1 commit into
Open
Conversation
Adds a new snippet paste dialog (Alt+V) that lets users paste or type multi-line code into an overlay textarea. On confirmation (Ctrl+D), the content is wrapped in a fenced code block and inserted at the cursor in the chat editor. Pressing Esc closes the dialog without changes. - internal/ui/dialog/snippet.go: new Snippet dialog backed by textarea - internal/ui/dialog/actions.go: new ActionInsertSnippet action type - internal/ui/model/keys.go: new Editor.PasteSnippet binding (alt+v) - internal/ui/model/ui.go: open dialog on alt+v; handle ActionInsertSnippet; add PasteSnippet to FullHelp bindings - internal/ui/dialog/snippet_test.go: 5 unit tests for dialog behavior Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
|
Thank you for your submission. We really appreciate it! Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request comment same as the below format. I have read the Contributor License Agreement (CLA) and hereby sign the CLA. You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite 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.
Summary
Editor.PasteSnippetto the FullHelp key bindings so users can discover it via Ctrl+G.Motivation
The chat editor currently handles pasted multi-line text in two ways: short pastes go directly into the textarea, and long pastes (>10 lines) become anonymous file attachments. Neither flow explicitly wraps content in code fences, which is the most common intent when a user pastes a snippet they want the model to analyse or edit.
This mirrors the Alt+V snippet-paste workflow familiar from Claude Code.
Test plan
go test ./internal/ui/dialog/... -run TestSnippet— 5 new unit tests all pass.go test ./...— all existing tests continue to pass (pre-existingTestDispatch_BashShebangfails on Windows due to missing WSL/bin/bash; unrelated to this change).Files changed
internal/ui/dialog/snippet.goSnippetdialog (textarea overlay)internal/ui/dialog/snippet_test.gointernal/ui/dialog/actions.goActionInsertSnippetactioninternal/ui/model/keys.goEditor.PasteSnippetbinding (alt+v)internal/ui/model/ui.go🤖 Generated with Claude Code