Files
xterm.js/addons/addon-webgl
Anthony Kim a56dc02cc7 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)
2026-07-04 12:46:27 -07:00
..
2024-07-07 09:15:25 -07:00
2026-02-13 06:59:24 -08:00
2024-07-14 08:52:15 -07:00

@xterm/addon-webgl

An addon for xterm.js that enables a WebGL2-based renderer. This addon requires xterm.js v4+.

Install

npm install --save @xterm/addon-webgl

Usage

import { Terminal } from '@xterm/xterm';
import { WebglAddon } from '@xterm/addon-webgl';

const terminal = new Terminal();
terminal.open(element);
terminal.loadAddon(new WebglAddon());

See the full API for more advanced usage.

Handling Context Loss

The browser may drop WebGL contexts for various reasons like OOM or after the system has been suspended. There is an API exposed that fires the webglcontextlost event on the canvas so embedders can handle it however they wish. An easy, but suboptimal way, to handle this is by disposing of WebglAddon when the event fires:

const terminal = new Terminal();
const addon = new WebglAddon();
addon.onContextLoss(e => {
  addon.dispose();
});
terminal.loadAddon(addon);

Read more about handling WebGL context losses on the Khronos wiki.