Skip to content

Commit a2bf588

Browse files
committed
fix(tui): allow Enter when @ autocomplete has no matches
When @ autocomplete shows "No matching items", pressing Enter should submit the prompt instead of doing nothing. **Problem:** - User types `@nonexistentfile` (text that doesn't match any files) - Autocomplete displays "No matching items" - Pressing Enter does nothing **Fix:** - Remove redundant e.preventDefault() when no matching items exist - Autocomplete now closes with single Enter press - Prompt submits immediately
1 parent 20399bb commit a2bf588

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -628,9 +628,15 @@ export function Autocomplete(props: {
628628
return
629629
}
630630
if (name === "return") {
631-
select()
632-
e.preventDefault()
633-
return
631+
const selected = options()[store.selected]
632+
if (selected) {
633+
select()
634+
e.preventDefault()
635+
return
636+
}
637+
if (options().length === 0) {
638+
hide()
639+
}
634640
}
635641
if (name === "tab") {
636642
const selected = options()[store.selected]

0 commit comments

Comments
 (0)