Skip to content

Commit 9f0418a

Browse files
committed
fix: app_exit keybind ignored when using <leader> (including default <leader>q)
1 parent 84d9b38 commit 9f0418a

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

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

packages/opencode/src/cli/cmd/tui/app.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ import { DialogHelp } from "./ui/dialog-help"
2020
import { CommandProvider, useCommandDialog } from "@tui/component/dialog-command"
2121
import { DialogAgent } from "@tui/component/dialog-agent"
2222
import { DialogSessionList } from "@tui/component/dialog-session-list"
23+
import { KeybindProvider, useKeybind } from "@tui/context/keybind"
2324
import { DialogWorkspaceList } from "@tui/component/dialog-workspace-list"
24-
import { KeybindProvider } from "@tui/context/keybind"
2525
import { ThemeProvider, useTheme } from "@tui/context/theme"
2626
import { Home } from "@tui/routes/home"
2727
import { Session } from "@tui/routes/session"
@@ -216,6 +216,14 @@ function App() {
216216
const sync = useSync()
217217
const exit = useExit()
218218
const promptRef = usePromptRef()
219+
const keybind = useKeybind()
220+
221+
useKeyboard((evt) => {
222+
if (!keybind.match("app_exit", evt)) return
223+
const prompt = promptRef.current?.current
224+
if (prompt && prompt.input !== "") return
225+
exit()
226+
})
219227

220228
useKeyboard((evt) => {
221229
if (!Flag.OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT) return

0 commit comments

Comments
 (0)