summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLuke Parker <[email protected]>2026-04-02 08:43:40 +1000
committerGitHub <[email protected]>2026-04-02 08:43:40 +1000
commitfa96cb9c6e7d0cafad065066c00c2119b94b68d9 (patch)
treeb3d812a7349b4a2a7fda36cc0d7c3df68f6b738e
parentcc30bfc94b07cf98e51d1c6f9e1f84dc00dbb6b4 (diff)
downloadopencode-fa96cb9c6e7d0cafad065066c00c2119b94b68d9.tar.gz
opencode-fa96cb9c6e7d0cafad065066c00c2119b94b68d9.zip
Fix selection expansion by retaining focused input selections during global key events (#20205)
-rw-r--r--packages/opencode/src/cli/cmd/tui/app.tsx8
1 files changed, 7 insertions, 1 deletions
diff --git a/packages/opencode/src/cli/cmd/tui/app.tsx b/packages/opencode/src/cli/cmd/tui/app.tsx
index ec048f86b..93d1fc19a 100644
--- a/packages/opencode/src/cli/cmd/tui/app.tsx
+++ b/packages/opencode/src/cli/cmd/tui/app.tsx
@@ -299,7 +299,8 @@ function App(props: { onSnapshot?: () => Promise<string[]> }) {
useKeyboard((evt) => {
if (!Flag.OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT) return
- if (!renderer.getSelection()) return
+ const sel = renderer.getSelection()
+ if (!sel) return
// Windows Terminal-like behavior:
// - Ctrl+C copies and dismisses selection
@@ -323,6 +324,11 @@ function App(props: { onSnapshot?: () => Promise<string[]> }) {
return
}
+ const focus = renderer.currentFocusedRenderable
+ if (focus?.hasSelection() && sel.selectedRenderables.includes(focus)) {
+ return
+ }
+
renderer.clearSelection()
})