ScreenBuffer class
An off-screen grid of Cells the widgets paint into, plus a diff-based renderDiff that emits the minimal ANSI to turn a previous frame into this one (so only changed cells are rewritten — no flicker, minimal bytes).
The buffer is terminal-agnostic: it produces a string of escape sequences and never touches IO. The owning app holds the "front" buffer (the last frame shown) and feeds it to renderDiff.
Constructors
- ScreenBuffer(int width, int height)
Properties
Methods
-
cellAt(
int x, int y) → Cell -
The cell at (
x,y), or Cell.blank when out of bounds. -
clear(
[Style style = Style.none]) → void -
Resets every cell to a blank in
style. -
drawText(
int x, int y, String text, Style style, {int? maxWidth}) → int -
Draws
textstarting at (x,y), one cell per rune, clipped to the row and tomaxWidthcolumns (when given). Tabs expand to a single space. Returns the column just past the last painted cell. -
fillRect(
int left, int top, int w, int h, String char, Style style) → void -
Fills
rect's area (clipped to the buffer) withcharinstyle. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
renderDiff(
ScreenBuffer? previous) → String -
Emits the ANSI needed to turn
previousinto this frame, rewriting only the cells that changed. Whenpreviousisnull(or a different size) the whole frame is drawn. -
setCell(
int x, int y, String char, Style style) → void -
Paints a single character at (
x,y); out-of-bounds writes are ignored. A multi-runecharis truncated to its first rune; an empty string paints a space. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited