Fix scroll off-by-one in synthetic flood; guard repro against buffer scroll

generateColoredAsciiFlood emitted a trailing \r\n after its final cell, so a
flood whose last line lands on the bottom row scrolled the screen. In the
alt-buffer repro this destroyed the pinned header row in the BUFFER, making
the 255/255 signature diff a content change, not renderer corruption. The
single-terminal merge path is actually healthy: with the scroll removed the
same 30-chunk merge-heavy workload renders the header with zero drift.

- generateColoredAsciiFlood: no linefeed after the final cell
- WebglReproExperiment: now a green guard; asserts row-1 buffer text first so
  a content bug can never masquerade as corruption again
- WebglVisual: accurate comments; erase rewritten lines so leftover prefill
  text doesn't look like corruption
- WebglSingleTermStress: replace stale EXPECTED-RED comment (test passes)
This commit is contained in:
Anthony Kim
2026-07-04 12:46:27 -07:00
parent e3399b1db8
commit a56dc02cc7
4 changed files with 50 additions and 22 deletions
@@ -37,11 +37,12 @@ test.describe('WebGL single-terminal heavy render + merge', () => {
await loadWebglStrict(ctx);
});
test('heavy merge churn must not crash the GlyphRenderer (xtermjs#322756)', async () => {
// EXPECTED RED: with a small page cap, atlas merges shrink the pages array
// while GlyphRenderer.render still indexes the old page count -> throws
// "Cannot read properties of undefined (reading 'version')" and the terminal
// garbles. Capture the crash via pageerror.
test('heavy merge churn must not crash the GlyphRenderer (vscode#322756)', async () => {
// Guard: heavy merges must not throw from GlyphRenderer.render. Note the
// page cap here is lowered AFTER the renderer was built, so _atlasTextures
// keeps its original (large) length and this test cannot hit the
// page-overflow crash; that scenario needs the cap lowered BEFORE loading
// the addon and is covered separately (WebglAtlasOverflow.test.ts).
const errors: string[] = [];
const onError = (e: Error): void => { errors.push(e.message); };
ctx.page.on('pageerror', onError);