diff options
| author | Mani Sundararajan <[email protected]> | 2026-01-08 12:22:24 -0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-01-08 14:22:24 -0600 |
| commit | 72062d22a0154306f8197285e062888c2c9197e7 (patch) | |
| tree | fabb2d1e7208a60935d891d8a4578b7d4ef66a63 | |
| parent | 9f90f0e8ed2f9849c88abcf35e25f2dfaf494e04 (diff) | |
| download | opencode-72062d22a0154306f8197285e062888c2c9197e7.tar.gz opencode-72062d22a0154306f8197285e062888c2c9197e7.zip | |
fix: cleanly restore terminal state on fatal error exit (#7359)
| -rw-r--r-- | packages/opencode/src/cli/cmd/tui/app.tsx | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/packages/opencode/src/cli/cmd/tui/app.tsx b/packages/opencode/src/cli/cmd/tui/app.tsx index 2af5b2115..50f4f1ae5 100644 --- a/packages/opencode/src/cli/cmd/tui/app.tsx +++ b/packages/opencode/src/cli/cmd/tui/app.tsx @@ -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> |
