Terminal.resize() already no-ops internally when dimensions haven't changed. The addon's guard prevented resize() from being called at all, forcing callers using ResizeObserver-based layouts to use perturbation workarounds (resize to rows-1, then fit) that race with the observer. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@xterm/addon-fit
An addon for xterm.js that enables fitting the terminal's dimensions to a containing element. This addon requires xterm.js v4+.
Install
npm install --save @xterm/addon-fit
Usage
import { Terminal } from '@xterm/xterm';
import { FitAddon } from '@xterm/addon-fit';
const terminal = new Terminal();
const fitAddon = new FitAddon();
terminal.loadAddon(fitAddon);
terminal.open(containerElement);
fitAddon.fit();
See the full API for more advanced usage.