fix: permission prompt should ignore keyboard events while dialog stack len > 0 (#10338)
This commit is contained in:
parent
6511243152
commit
077d17d433
1 changed files with 7 additions and 0 deletions
|
|
@ -14,6 +14,7 @@ import { LANGUAGE_EXTENSIONS } from "@/lsp/language"
|
||||||
import { Keybind } from "@/util/keybind"
|
import { Keybind } from "@/util/keybind"
|
||||||
import { Locale } from "@/util/locale"
|
import { Locale } from "@/util/locale"
|
||||||
import { Global } from "@/global"
|
import { Global } from "@/global"
|
||||||
|
import { useDialog } from "../../ui/dialog"
|
||||||
|
|
||||||
type PermissionStage = "permission" | "always" | "reject"
|
type PermissionStage = "permission" | "always" | "reject"
|
||||||
|
|
||||||
|
|
@ -304,8 +305,11 @@ function RejectPrompt(props: { onConfirm: (message: string) => void; onCancel: (
|
||||||
const textareaKeybindings = useTextareaKeybindings()
|
const textareaKeybindings = useTextareaKeybindings()
|
||||||
const dimensions = useTerminalDimensions()
|
const dimensions = useTerminalDimensions()
|
||||||
const narrow = createMemo(() => dimensions().width < 80)
|
const narrow = createMemo(() => dimensions().width < 80)
|
||||||
|
const dialog = useDialog()
|
||||||
|
|
||||||
useKeyboard((evt) => {
|
useKeyboard((evt) => {
|
||||||
|
if (dialog.stack.length > 0) return
|
||||||
|
|
||||||
if (evt.name === "escape" || keybind.match("app_exit", evt)) {
|
if (evt.name === "escape" || keybind.match("app_exit", evt)) {
|
||||||
evt.preventDefault()
|
evt.preventDefault()
|
||||||
props.onCancel()
|
props.onCancel()
|
||||||
|
|
@ -384,8 +388,11 @@ function Prompt<const T extends Record<string, string>>(props: {
|
||||||
})
|
})
|
||||||
const diffKey = Keybind.parse("ctrl+f")[0]
|
const diffKey = Keybind.parse("ctrl+f")[0]
|
||||||
const narrow = createMemo(() => dimensions().width < 80)
|
const narrow = createMemo(() => dimensions().width < 80)
|
||||||
|
const dialog = useDialog()
|
||||||
|
|
||||||
useKeyboard((evt) => {
|
useKeyboard((evt) => {
|
||||||
|
if (dialog.stack.length > 0) return
|
||||||
|
|
||||||
if (evt.name === "left" || evt.name == "h") {
|
if (evt.name === "left" || evt.name == "h") {
|
||||||
evt.preventDefault()
|
evt.preventDefault()
|
||||||
const idx = keys.indexOf(store.selected)
|
const idx = keys.indexOf(store.selected)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue