Skip to content

fix(terminal): don't let onResize force a size report - #145

Merged
AThraen merged 1 commit into
mainfrom
fix/onresize-force
Sep 30, 2026
Merged

AThraen merged 1 commit into
mainfrom
fix/onresize-force

Conversation

@AThraen

@AThraen AThraen commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

Why

term.onResize(postSize) passed xterm's {cols, rows} event object straight into postSize's force parameter, where it is truthy.

That is exactly the latent bug #141 wrapped the ResizeObserver, requestAnimationFrame and document.fonts.ready sites for — this call site was simply missed. Both the review behind #143 and a separate review of the merged #141 flagged it independently, and #143 explicitly left it as a known one-liner.

Effect

Small, which is why it survived: a resize originating inside the terminal (CSI 8 t) bypassed the duplicate-size check and posted a resize even when the size already matched what the host had been told. The host just calls _pty.Resize with the same values, so nothing breaks — but force exists for one purpose, acknowledging an options token when the column count happens not to change, and having it permanently on for ordinary resizes defeats the dedupe the same mechanism relies on.

After this

Every doFit / postSize call site is either an explicit call or wrapped, and the only force: true left in the file is settle()'s options ack, which is deliberate.

Testing

node --check clean; build clean at 0 warnings, 597/597 unit tests pass. None of those cover page-side JS, so this is reasoned against the shipped xterm.js behaviour rather than exercised in a browser.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NDsEfog5kVkT5NmX1Ya5be

`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) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NDsEfog5kVkT5NmX1Ya5be
@AThraen
AThraen merged commit 43afabf into main Sep 30, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant