fix: cleanly restore terminal state on fatal error exit (#7359)

This commit is contained in:
Mani Sundararajan 2026-01-08 12:22:24 -08:00 committed by GitHub
parent 9f90f0e8ed
commit 72062d22a0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -653,9 +653,17 @@ function ErrorComponent(props: {
mode?: "dark" | "light"
}) {
const term = useTerminalDimensions()
const renderer = useRenderer()
const handleExit = async () => {
renderer.setTerminalTitle("")
renderer.destroy()
props.onExit()
}
useKeyboard((evt) => {
if (evt.ctrl && evt.name === "c") {
props.onExit()
handleExit()
}
})
const [copied, setCopied] = createSignal(false)
@ -708,7 +716,7 @@ function ErrorComponent(props: {
<box onMouseUp={props.reset} backgroundColor={colors.primary} padding={1}>
<text fg={colors.bg}>Reset TUI</text>
</box>
<box onMouseUp={props.onExit} backgroundColor={colors.primary} padding={1}>
<box onMouseUp={handleExit} backgroundColor={colors.primary} padding={1}>
<text fg={colors.bg}>Exit</text>
</box>
</box>