Skip to content

Commit 5565f14

Browse files
committed
tab to accept autocomplete
1 parent 10a4455 commit 5565f14

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

packages/opencode/src/cli/cmd/tui/component/dialog-command.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ function init() {
2828
return registrations().flatMap((x) => x())
2929
})
3030

31+
let keybinds = true
3132
useKeyboard((evt) => {
33+
if (!keybinds) return
3234
for (const option of options()) {
3335
if (option.keybind && keybind.match(option.keybind, evt)) {
3436
evt.preventDefault()
@@ -47,6 +49,9 @@ function init() {
4749
}
4850
}
4951
},
52+
keybinds(enabled: boolean) {
53+
keybinds = enabled
54+
},
5055
show() {
5156
dialog.replace(() => <DialogCommand options={options()} />)
5257
},

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ export function Autocomplete(props: {
321321
}
322322

323323
function show(mode: "@" | "/") {
324+
command.keybinds(false)
324325
setStore({
325326
visible: mode,
326327
index: props.input().visualCursor.offset,
@@ -338,6 +339,7 @@ export function Autocomplete(props: {
338339
const cursor = props.input().logicalCursor
339340
props.input().deleteRange(0, 0, cursor.row, cursor.col)
340341
}
342+
command.keybinds(true)
341343
setStore("visible", false)
342344
}
343345

0 commit comments

Comments
 (0)