fix(tui): add plain text paste - #34123
Conversation
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
|
Great PR — this is exactly the fix I've been looking for. I independently diagnosed the same root cause: when pasting a file path from the system clipboard into OpenCode's TUI, the Adding Tested scenario this fixes: "copy a file path from VS Code Explorer → paste into OpenCode → path gets replaced with a file reference like Looking forward to seeing this merged! |
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Issue for this PR
Closes #34006
Type of change
What does this PR do?
Adds a TUI plain-text paste command,
prompt.paste_plain, bound toCtrl+Alt+V. This reads clipboard text directly and inserts it into the prompt, bypassing the existing local image/PDF path detection. ExistingCtrl+Vpaste behavior is unchanged, so users can still paste images and attachments normally.This fixes the path-as-text case because pasted file paths no longer have to go through
pasteInputText(), which can convert valid image/PDF paths into attachments before the model sees the literal path.How did you verify your code works?
bun test test/config.test.tsx test/clipboard.test.tsfrompackages/tuibun testfrompackages/tuibunx oxlint packages/tui/src/clipboard.ts packages/tui/src/context/clipboard.tsx packages/tui/src/config/keybind.ts packages/tui/src/component/prompt/index.tsx packages/tui/test/config.test.tsxreports 0 errorsbun typecheckwith Bun 1.3.14 currently fails in@opencode-ai/tuiatsrc/context/data.tsx; I verified the same failure exists on cleandev, so this PR leaves that unrelated issue untouched.Screenshots / recordings
No screenshot. This is a TUI keybinding/input behavior change.
Checklist