summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAiden Cline <[email protected]>2026-04-16 14:38:39 -0500
committerGitHub <[email protected]>2026-04-16 14:38:39 -0500
commit6c3b28db64e47895553949880f296bae74691f4a (patch)
treeb8e62d597e8e27c214c17298ac01c96a460b9e0e
parent2fe9d9447070f6967d80b0a8f74239e1969d9e1c (diff)
downloadopencode-6c3b28db64e47895553949880f296bae74691f4a.tar.gz
opencode-6c3b28db64e47895553949880f296bae74691f4a.zip
fix: ensure that double pasting doesnt happen after tui perf commit was merged (#22880)
-rw-r--r--packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx9
1 files changed, 6 insertions, 3 deletions
diff --git a/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx b/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx
index e64a16eb8..82c4a7222 100644
--- a/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx
+++ b/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx
@@ -1031,6 +1031,10 @@ export function Prompt(props: PromptProps) {
return
}
+ // Once we cross an async boundary below, the terminal may perform its
+ // default paste unless we suppress it first and handle insertion ourselves.
+ event.preventDefault()
+
const filepath = iife(() => {
const raw = pastedContent.replace(/^['"]+|['"]+$/g, "")
if (raw.startsWith("file://")) {
@@ -1048,7 +1052,6 @@ export function Prompt(props: PromptProps) {
const filename = path.basename(filepath)
// Handle SVG as raw text content, not as base64 image
if (mime === "image/svg+xml") {
- event.preventDefault()
const content = await Filesystem.readText(filepath).catch(() => {})
if (content) {
pasteText(content, `[SVG: ${filename ?? "image"}]`)
@@ -1056,7 +1059,6 @@ export function Prompt(props: PromptProps) {
}
}
if (mime.startsWith("image/") || mime === "application/pdf") {
- event.preventDefault()
const content = await Filesystem.readArrayBuffer(filepath)
.then((buffer) => Buffer.from(buffer).toString("base64"))
.catch(() => {})
@@ -1078,11 +1080,12 @@ export function Prompt(props: PromptProps) {
(lineCount >= 3 || pastedContent.length > 150) &&
!sync.data.config.experimental?.disable_paste_summary
) {
- event.preventDefault()
pasteText(pastedContent, `[Pasted ~${lineCount} lines]`)
return
}
+ input.insertText(normalizedText)
+
// Force layout update and render for the pasted content
setTimeout(() => {
// setTimeout is a workaround and needs to be addressed properly