From cc3dbb40b5e6714da70d2efa9e8327d6c3a0ddb5 Mon Sep 17 00:00:00 2001 From: Allan Thraen Date: Wed, 30 Sep 2026 15:54:07 +0200 Subject: [PATCH] fix(terminal): don't let onResize force a size report MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `term.onResize(postSize)` passed xterm's `{cols, rows}` event object straight into postSize's `force` parameter, where it is truthy. That is the same latent bug #141 wrapped the ResizeObserver, requestAnimationFrame and document.fonts.ready sites for, and this one call site was missed — both #143's review and a review of the merged #141 found it independently. Effect is small: a resize originating inside the terminal (CSI 8 t) bypassed the duplicate-size check and posted even when the size already matched what the host had been told. `force` exists to acknowledge an options token when the column count happens not to change; it is not meant to be on for ordinary resizes. Every doFit/postSize call site is now either explicit or wrapped; the only `force: true` left is settle()'s options ack, which is deliberate. Verified with `node --check`; build clean at 0 warnings, 597/597 tests (none cover page-side JS — this is reasoned, not exercised). Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01NDsEfog5kVkT5NmX1Ya5be --- src/CodeShellManager/Assets/terminal-init.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/CodeShellManager/Assets/terminal-init.js b/src/CodeShellManager/Assets/terminal-init.js index d383f90..444f8ec 100644 --- a/src/CodeShellManager/Assets/terminal-init.js +++ b/src/CodeShellManager/Assets/terminal-init.js @@ -103,7 +103,13 @@ // Still worth keeping alongside doFit(): a resize can also originate inside the // terminal (CSI 8 t) rather than from a fit of ours. - term.onResize(postSize); + // + // Wrapped, for the same reason the ResizeObserver, requestAnimationFrame and + // document.fonts.ready sites are: xterm hands the listener a {cols, rows} object, which + // as a bare reference arrives as postSize's `force` and is truthy — so this one call + // site silently bypassed the duplicate-size check that force exists to override only + // for an options ack. + term.onResize(function () { postSize(); }); term.open(document.getElementById('terminal')); doFit();