From 4e5892fde64a9e25ba36db7a92b8a6c9f1e7553e Mon Sep 17 00:00:00 2001 From: Evan Sosenko Date: Mon, 12 Jan 2026 23:14:57 -0800 Subject: [PATCH] fix: app_exit keybind ignored when using (including default q) --- packages/opencode/src/cli/cmd/tui/app.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/opencode/src/cli/cmd/tui/app.tsx b/packages/opencode/src/cli/cmd/tui/app.tsx index 1fea3f4b305..57378d60ac4 100644 --- a/packages/opencode/src/cli/cmd/tui/app.tsx +++ b/packages/opencode/src/cli/cmd/tui/app.tsx @@ -18,7 +18,7 @@ import { DialogHelp } from "./ui/dialog-help" import { CommandProvider, useCommandDialog } from "@tui/component/dialog-command" import { DialogAgent } from "@tui/component/dialog-agent" import { DialogSessionList } from "@tui/component/dialog-session-list" -import { KeybindProvider } from "@tui/context/keybind" +import { KeybindProvider, useKeybind } from "@tui/context/keybind" import { ThemeProvider, useTheme } from "@tui/context/theme" import { Home } from "@tui/routes/home" import { Session } from "@tui/routes/session" @@ -195,6 +195,14 @@ function App() { const sync = useSync() const exit = useExit() const promptRef = usePromptRef() + const keybind = useKeybind() + + useKeyboard((evt) => { + if (!keybind.match("app_exit", evt)) return + const prompt = promptRef.current?.current + if (prompt && prompt.input !== "") return + exit() + }) // Wire up console copy-to-clipboard via opentui's onCopySelection callback renderer.console.onCopySelection = async (text: string) => {