diff --git a/apps/desktop/src/renderer/lib/terminal/terminal-runtime.ts b/apps/desktop/src/renderer/lib/terminal/terminal-runtime.ts index aad67d3fd96..9f406bc9b10 100644 --- a/apps/desktop/src/renderer/lib/terminal/terminal-runtime.ts +++ b/apps/desktop/src/renderer/lib/terminal/terminal-runtime.ts @@ -137,6 +137,7 @@ function hostIsVisible(container: HTMLDivElement | null): boolean { function measureAndResize( runtime: TerminalRuntime, onResize?: () => void, + options: { forceNotify?: boolean } = {}, ): void { if (!hostIsVisible(runtime.container)) return; const { terminal } = runtime; @@ -165,7 +166,11 @@ function measureAndResize( terminal.refresh(0, Math.max(0, terminal.rows - 1)); - if (terminal.cols !== prevCols || terminal.rows !== prevRows) { + if ( + options.forceNotify || + terminal.cols !== prevCols || + terminal.rows !== prevRows + ) { onResize?.(); } }); @@ -189,7 +194,10 @@ function createResizeScheduler( const run = () => { timeoutId = null; - measureAndResize(runtime, onResize); + // Notify unconditionally (VS Code parity): a reveal after a zero-size + // hide re-sends PTY dims even when unchanged, resyncing a PTY resized + // elsewhere meanwhile. Same-size re-sends are kernel no-ops. + measureAndResize(runtime, onResize, { forceNotify: true }); }; const observe: ResizeObserverCallback = (entries) => {