summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAiden Cline <[email protected]>2025-11-04 13:22:18 -0600
committerAiden Cline <[email protected]>2025-11-04 13:22:18 -0600
commit52e2b40610da07898339e8f23190fd3b18d09611 (patch)
treec4afad442e3eb4dba09416c96a3a2fd9ab2bd88c
parentee1ff8cc07fcac5e6e879bc8084835f339a6b52c (diff)
downloadopencode-52e2b40610da07898339e8f23190fd3b18d09611.tar.gz
opencode-52e2b40610da07898339e8f23190fd3b18d09611.zip
fix: stop showing auto complete if user types a space
-rw-r--r--packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx18
1 files changed, 17 insertions, 1 deletions
diff --git a/packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx b/packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx
index 02fd3fccb..812496ddc 100644
--- a/packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx
+++ b/packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx
@@ -54,6 +54,12 @@ export function Autocomplete(props: {
const val = props.input().getTextRange(store.index + 1, props.input().cursorOffset + 1)
+ // If the filter contains a space, hide the autocomplete
+ if (val.includes(" ")) {
+ hide()
+ return undefined
+ }
+
return val
})
@@ -373,7 +379,17 @@ export function Autocomplete(props: {
return store.visible
},
onInput() {
- if (store.visible && props.input().cursorOffset <= store.index) hide()
+ if (store.visible) {
+ if (props.input().cursorOffset <= store.index) {
+ hide()
+ return
+ }
+ // Check if a space was typed after the trigger character
+ const currentText = props.input().getTextRange(store.index + 1, props.input().cursorOffset + 1)
+ if (currentText.includes(" ")) {
+ hide()
+ }
+ }
},
onKeyDown(e: KeyEvent) {
if (store.visible) {