diff --git a/src/components/XtermPane.tsx b/src/components/XtermPane.tsx index 242fa27..910a3de 100644 --- a/src/components/XtermPane.tsx +++ b/src/components/XtermPane.tsx @@ -175,6 +175,8 @@ export default function XtermPane({ // final size — bash gets a single clean redraw. let resizeRaf: number | null = null; let resizePtyTimer: number | null = null; + let lastSentCols = -1; + let lastSentRows = -1; ro = new ResizeObserver(() => { if (resizeRaf != null) return; resizeRaf = requestAnimationFrame(() => { @@ -186,9 +188,17 @@ export default function XtermPane({ if (resizePtyTimer != null) clearTimeout(resizePtyTimer); resizePtyTimer = window.setTimeout(() => { resizePtyTimer = null; - if (paneId != null && term) { - void resizePane(paneId, term.cols, term.rows); + if (paneId == null || !term) return; + // Skip if the cell grid didn't actually change — saves a + // pointless SIGWINCH that would make bash redraw its prompt + // (which feeds back into onDataReceived and causes the idle + // indicator to flap; see the analysis around v0.2.2). + if (term.cols === lastSentCols && term.rows === lastSentRows) { + return; } + lastSentCols = term.cols; + lastSentRows = term.rows; + void resizePane(paneId, term.cols, term.rows); }, 150); } catch (e) { console.warn("resize failed", e);