Skip to content

Commit 077d17d

Browse files
fix: permission prompt should ignore keyboard events while dialog stack len > 0 (#10338)
1 parent 6511243 commit 077d17d

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

packages/opencode/src/cli/cmd/tui/routes/session/permission.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { LANGUAGE_EXTENSIONS } from "@/lsp/language"
1414
import { Keybind } from "@/util/keybind"
1515
import { Locale } from "@/util/locale"
1616
import { Global } from "@/global"
17+
import { useDialog } from "../../ui/dialog"
1718

1819
type PermissionStage = "permission" | "always" | "reject"
1920

@@ -304,8 +305,11 @@ function RejectPrompt(props: { onConfirm: (message: string) => void; onCancel: (
304305
const textareaKeybindings = useTextareaKeybindings()
305306
const dimensions = useTerminalDimensions()
306307
const narrow = createMemo(() => dimensions().width < 80)
308+
const dialog = useDialog()
307309

308310
useKeyboard((evt) => {
311+
if (dialog.stack.length > 0) return
312+
309313
if (evt.name === "escape" || keybind.match("app_exit", evt)) {
310314
evt.preventDefault()
311315
props.onCancel()
@@ -384,8 +388,11 @@ function Prompt<const T extends Record<string, string>>(props: {
384388
})
385389
const diffKey = Keybind.parse("ctrl+f")[0]
386390
const narrow = createMemo(() => dimensions().width < 80)
391+
const dialog = useDialog()
387392

388393
useKeyboard((evt) => {
394+
if (dialog.stack.length > 0) return
395+
389396
if (evt.name === "left" || evt.name == "h") {
390397
evt.preventDefault()
391398
const idx = keys.indexOf(store.selected)

0 commit comments

Comments
 (0)