From e016a3f00e90af86dc91a5f878ceab5521764b13 Mon Sep 17 00:00:00 2001 From: Arthur Freitas Ramos Date: Sat, 24 Jan 2026 16:18:03 -0300 Subject: [PATCH 1/2] fix(opentui): handle SIGINT to prevent garbled output on Windows Fixes #10414 On Windows, pressing Ctrl+C caused the terminal to output ANSI escape sequences because the 60 FPS renderer was not being properly cleaned up. This adds a SIGINT handler in the App component that calls the exit function to properly destroy the renderer. --- packages/opencode/src/cli/cmd/tui/app.tsx | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/packages/opencode/src/cli/cmd/tui/app.tsx b/packages/opencode/src/cli/cmd/tui/app.tsx index 4b177e292cf..8648d200976 100644 --- a/packages/opencode/src/cli/cmd/tui/app.tsx +++ b/packages/opencode/src/cli/cmd/tui/app.tsx @@ -2,7 +2,19 @@ import { render, useKeyboard, useRenderer, useTerminalDimensions } from "@opentu import { Clipboard } from "@tui/util/clipboard" import { TextAttributes } from "@opentui/core" import { RouteProvider, useRoute } from "@tui/context/route" -import { Switch, Match, createEffect, untrack, ErrorBoundary, createSignal, onMount, batch, Show, on } from "solid-js" +import { + Switch, + Match, + createEffect, + untrack, + ErrorBoundary, + createSignal, + onMount, + onCleanup, + batch, + Show, + on, +} from "solid-js" import { Installation } from "@/installation" import { Flag } from "@/flag/flag" import { DialogProvider, useDialog } from "@tui/ui/dialog" @@ -196,6 +208,14 @@ function App() { const exit = useExit() const promptRef = usePromptRef() + // Handle SIGINT (Ctrl+C) to properly cleanup renderer on Windows + // Without this, the 60 FPS render loop continues outputting ANSI sequences + onMount(() => { + const handleSigint = () => exit() + process.on("SIGINT", handleSigint) + onCleanup(() => process.off("SIGINT", handleSigint)) + }) + // Wire up console copy-to-clipboard via opentui's onCopySelection callback renderer.console.onCopySelection = async (text: string) => { if (!text || text.length === 0) return From 15e5f96dcce41e475b53d12a6b15fafd31e5b34c Mon Sep 17 00:00:00 2001 From: Arthur Freitas Ramos Date: Sat, 24 Jan 2026 16:32:45 -0300 Subject: [PATCH 2/2] ci: retrigger workflows