Skip to content

Commit a32cf70

Browse files
committed
tui: fix /new slash command being persisted in prompt input
1 parent a607f33 commit a32cf70

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,8 +352,8 @@ export function Autocomplete(props: {
352352
function select() {
353353
const selected = options()[store.selected]
354354
if (!selected) return
355-
selected.onSelect?.()
356355
hide()
356+
selected.onSelect?.()
357357
}
358358

359359
function show(mode: "@" | "/") {
@@ -374,6 +374,10 @@ export function Autocomplete(props: {
374374
if (store.visible === "/" && !text.endsWith(" ") && text.startsWith("/")) {
375375
const cursor = props.input().logicalCursor
376376
props.input().deleteRange(0, 0, cursor.row, cursor.col)
377+
// Sync the prompt store immediately since onContentChange is async
378+
props.setPrompt((draft) => {
379+
draft.input = props.input().plainText
380+
})
377381
}
378382
command.keybinds(true)
379383
setStore("visible", false)

0 commit comments

Comments
 (0)