settle method
void
settle()
Refits across several frames and pins the view to the bottom. Use after a fullscreen toggle and once after the initial mount.
The flex/dvh layout — and, on mobile, browser chrome animating in or out —
settles over a few hundred milliseconds, so a single immediate fit measures
a stale box and leaves the terminal mis-sized.
Implementation
void settle() {
void apply() {
if (_disposed) return;
fit();
// A layout change can leave the xterm canvas stale, so force a redraw of
// the visible rows in normal mode.
if (!isFullscreen()) {
final t = term;
if (t is XtermTerminalView) t.refresh();
}
term.scrollToBottom();
}
scheduleFit();
web.window.requestAnimationFrame(((double _) => apply()).toJS);
// Catch the post-animation / post-settle box size.
for (final ms in const [120, 300, 500]) {
Timer(Duration(milliseconds: ms), apply);
}
}