refactor(tui): centralize application exit (#31524)

This commit is contained in:
Dax
2026-06-09 11:46:02 -04:00
committed by GitHub
parent 960eacebcf
commit 37522185d3
32 changed files with 176 additions and 1217 deletions
+3 -2
View File
@@ -27,7 +27,7 @@ import { useSync } from "../../context/sync"
import { useEvent } from "../../context/event"
import { editorSelectionKey, useEditorContext, type EditorSelection } from "../../context/editor"
import { normalizePromptContent, openEditor } from "../../editor"
import { destroyRenderer } from "../../util/renderer"
import { useExit } from "../../context/exit"
import { promptOffsetWidth } from "../../prompt/display"
import { createStore, produce, unwrap } from "solid-js/store"
import { usePromptHistory, type PromptInfo } from "../../prompt/history"
@@ -163,6 +163,7 @@ export function Prompt(props: PromptProps) {
const agentShortcut = useCommandShortcut("agent.cycle")
const paletteShortcut = useCommandShortcut("command.palette.show")
const renderer = useRenderer()
const exit = useExit()
const dimensions = useTerminalDimensions()
const { theme, syntax } = useTheme()
const kv = useKV()
@@ -955,7 +956,7 @@ export function Prompt(props: PromptProps) {
if (!agent) return false
const trimmed = store.prompt.input.trim()
if (trimmed === "exit" || trimmed === "quit" || trimmed === ":q") {
destroyRenderer(renderer)
void exit()
return true
}
const selectedModel = local.model.current()