fix(terminal): render completed synchronized frames immediately - #2521
fix(terminal): render completed synchronized frames immediately#2521binaricat wants to merge 6 commits into
Conversation
Adds scripts/patch-xterm-sync-render.cjs (run from postinstall, after the existing webgl atlas patch) to render a synchronized-output frame the moment it closes instead of on the next debounced tick. xterm buffers rows while DEC 2026 synchronized output is on and, on close, schedules the paint through the render debouncer. Under a continuous full-screen animation the next frame opens a new 2026 block before that rAF fires, and `_renderRows` skips while sync is on, so the paint is dropped and the frame only appears on the 1000ms sync timeout — pinning the display at ~1fps. The patch renders synchronously when a sync buffer was just flushed, so a completed frame paints before the next can reopen the mode. Measured against a 30fps animated-background TUI: ~1fps to the frame arrival rate, coherent (no partial-frame tearing). Idempotent and marker-guarded, like patch-xterm-webgl-atlas.cjs; a version bump that moves the minified target fails the install rather than silently losing the fix. Upstreamable to xterm.js. Assisted by AI.
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Codex reported no major issues. This PR is marked ready for human review/merge. |
|
@codex review |
|
Codex Review: Didn't find any major issues. Chef's kiss. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Codex reported no major issues. This PR is marked ready for human review/merge. |
1 similar comment
|
Codex reported no major issues. This PR is marked ready for human review/merge. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a6bdae1ca7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Automatic Codex fix did not finish cleanly (agent, protected paths, or verification failed). Marking for human review. |
|
@codex review |
|
@codex review |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Codex reported no major issues. This PR is marked ready for human review/merge. |
1 similar comment
|
Codex reported no major issues. This PR is marked ready for human review/merge. |
Summary
Render each completed DEC 2026 synchronized-output frame immediately, so continuous terminal animations do not stall at roughly one frame per second.
This is the narrow xterm-side fix extracted from #2489. It deliberately excludes frame dropping, flow-control changes, write watchdogs, and terminal settings. The original implementation commit keeps @s-celles as author.
The fix covers both xterm builds used by development and production. It only forces an immediate refresh when synchronized output actually changes from open to closed; redundant close commands retain xterm's normal batched refresh behavior.
Type of Change
Related Issue (optional)
Related to #2467 and #2489. Inspired by xtermjs/xterm.js#6073, with additional handling for complete frames delivered in one input chunk.
Changes Made
postinstallto both xterm builds.Screenshots / Demo
With pristine xterm, both CJS and ESM builds report zero renders before the next synchronized frame closes in all three input layouts. With this fix, both builds report one immediate render in all three layouts. One hundred redundant close commands still produce zero immediate renders and one normal batched render.
Testing
npm run test:xterm-sync-render)npm run lint)origin/main(SSH auth retry and SFTP resume baseline)npm run build)Checklist