File tree Expand file tree Collapse file tree
packages/opencode/src/cli/cmd/tui Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,8 +20,8 @@ import { DialogHelp } from "./ui/dialog-help"
2020import { CommandProvider , useCommandDialog } from "@tui/component/dialog-command"
2121import { DialogAgent } from "@tui/component/dialog-agent"
2222import { DialogSessionList } from "@tui/component/dialog-session-list"
23+ import { KeybindProvider , useKeybind } from "@tui/context/keybind"
2324import { DialogWorkspaceList } from "@tui/component/dialog-workspace-list"
24- import { KeybindProvider } from "@tui/context/keybind"
2525import { ThemeProvider , useTheme } from "@tui/context/theme"
2626import { Home } from "@tui/routes/home"
2727import { 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
You can’t perform that action at this time.
0 commit comments