Skip to content

Commit 6e1400f

Browse files
authored
dialog aware prompt cursor (#20753)
1 parent bf26c08 commit 6e1400f

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

  • packages/opencode/src/cli/cmd/tui/component/prompt

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -442,8 +442,15 @@ export function Prompt(props: PromptProps) {
442442
})
443443

444444
createEffect(() => {
445-
if (props.visible !== false) input?.focus()
446-
if (props.visible === false) input?.blur()
445+
if (!input || input.isDestroyed) return
446+
if (props.visible === false || dialog.stack.length > 0) {
447+
input.blur()
448+
return
449+
}
450+
451+
// Slot/plugin updates can remount the background prompt while a dialog is open.
452+
// Keep focus with the dialog and let the prompt reclaim it after the dialog closes.
453+
input.focus()
447454
})
448455

449456
createEffect(() => {

0 commit comments

Comments
 (0)