Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit 52e2b40

Browse files
committed
fix: stop showing auto complete if user types a space
1 parent ee1ff8c commit 52e2b40

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ export function Autocomplete(props: {
5454

5555
const val = props.input().getTextRange(store.index + 1, props.input().cursorOffset + 1)
5656

57+
// If the filter contains a space, hide the autocomplete
58+
if (val.includes(" ")) {
59+
hide()
60+
return undefined
61+
}
62+
5763
return val
5864
})
5965

@@ -373,7 +379,17 @@ export function Autocomplete(props: {
373379
return store.visible
374380
},
375381
onInput() {
376-
if (store.visible && props.input().cursorOffset <= store.index) hide()
382+
if (store.visible) {
383+
if (props.input().cursorOffset <= store.index) {
384+
hide()
385+
return
386+
}
387+
// Check if a space was typed after the trigger character
388+
const currentText = props.input().getTextRange(store.index + 1, props.input().cursorOffset + 1)
389+
if (currentText.includes(" ")) {
390+
hide()
391+
}
392+
}
377393
},
378394
onKeyDown(e: KeyEvent) {
379395
if (store.visible) {

0 commit comments

Comments
 (0)