From 6d3566e10f856c922727ef861227a6f2a83b175f Mon Sep 17 00:00:00 2001 From: cpacker Date: Fri, 16 Jan 2026 18:23:48 -0800 Subject: [PATCH] fix: Guard resize clears against minor column jitter during streaming --- src/cli/App.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/cli/App.tsx b/src/cli/App.tsx index 3441b53..9753095 100644 --- a/src/cli/App.tsx +++ b/src/cli/App.tsx @@ -172,6 +172,7 @@ import { useTerminalRows, useTerminalWidth } from "./hooks/useTerminalWidth"; // Used only for terminal resize, not for dialog dismissal (see PR for details) const CLEAR_SCREEN_AND_HOME = "\u001B[2J\u001B[H"; +const MIN_RESIZE_DELTA = 2; // Feature flag: Check for pending approvals before sending messages // This prevents infinite thinking state when there's an orphaned approval @@ -991,6 +992,13 @@ export default function App({ return; } + const delta = Math.abs(columns - prev); + const isMinorJitter = delta > 0 && delta < MIN_RESIZE_DELTA; + if (streaming && isMinorJitter) { + prevColumnsRef.current = columns; + return; + } + // Debounce to avoid flicker from rapid resize events (e.g., drag resize, Ghostty focus) // Clear and remount must happen together - otherwise Static re-renders on top of existing content resizeClearTimeout.current = setTimeout(() => { @@ -1015,7 +1023,7 @@ export default function App({ resizeClearTimeout.current = null; } }; - }, [columns]); + }, [columns, streaming]); // Commit immutable/finished lines into the historical log const commitEligibleLines = useCallback((b: Buffers) => {