feat(tui): ctrl+v pastes a clipboard image into the first prompt - #307
Merged
Merged
Conversation
A terminal paste only carries text, so like Claude Code the new-session prompt field now reads the clipboard itself on ctrl+v: an image is saved to a temp PNG and its path inserted at the cursor (agents read an image path as the image). No image falls through to the textarea's text paste. macOS only (osascript); over SSH it reads the host's clipboard. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
What
Ctrl+V on the new-session form's first-prompt field now pastes clipboard images: the image is saved to a temp PNG and its path is inserted at the cursor. With no image on the clipboard it falls through to the textarea's existing text paste, unchanged.
Why ctrl+v, not cmd+v
Cmd+V is handled by the terminal emulator and only ever sends text; the app never sees it. Ctrl+V is a real keypress, so the TUI can read the clipboard itself — the same trick Claude Code uses.
Notes
internal/tui/clipimage.go.osascript); Linux (wl-paste/xclip) can follow when needed.Testing
TestNewSessionPromptCtrlVPastesClipboardImagePath(red without the hook).internal/terminalonly fails locally when run inside Ghostty because of its env vars; unrelated).🤖 Generated with Claude Code