Buffer class final

A 2D buffer of Lines representing a terminal screen or a portion of it.

The buffer maintains a grid of Cells and tracks which lines have been "touched" (modified) to allow for efficient incremental rendering.

Upstream: third_party/ultraviolet/buffer.go (Buffer).

Constructors

Buffer.create(int width, int height)
factory
Buffer.fromCells(List<List<Cell>> cellLines)
Creates a buffer from pre-built cells without applying Line.set().
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
lines List<Line>
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
touched List<LineData?>
getter/setter pair

Methods

bounds() Rectangle
Returns the full buffer bounds as a Rectangle.
cellAt(int x, int y) Cell?
Returns the cell at (x, y), or null if out of bounds.
clear() → void
Clears the buffer over its full bounds.
clearArea(Rectangle area) → void
Clears the buffer within area (fills with spaces).
clone() Buffer
Clones the entire buffer into a new buffer.
cloneArea(Rectangle area) Buffer?
Clones area into a new buffer, or returns null if out-of-bounds.
deleteCell(int x, int y, int n, Cell? cell) → void
Deletes n cells at (x,y) within full bounds (ansi DCH semantics).
deleteCellArea(int x, int y, int n, Cell? cell, Rectangle area) → void
Deletes n cells at (x,y) within area (ansi DCH semantics).
deleteLine(int y, int n, Cell? cell) → void
Deletes n lines at y within full bounds.
deleteLineArea(int y, int n, Cell? cell, Rectangle area) → void
Deletes n lines at y within area (ansi DL semantics).
draw(Screen screen, Rectangle area) → void
Draws this buffer onto screen at the specified area.
fill(Cell? cell) → void
Fills the buffer with cell over its full bounds.
fillArea(Cell? cell, Rectangle area) → void
Fills the buffer with cell within area.
height() int
The buffer height in cells.
insertCell(int x, int y, int n, Cell? cell) → void
Inserts n cells at (x,y) within full bounds (ansi ICH semantics).
insertCellArea(int x, int y, int n, Cell? cell, Rectangle area) → void
Inserts n cells at (x,y) within area (ansi ICH semantics).
insertLine(int y, int n, Cell? cell) → void
Inserts n lines at y within full bounds.
insertLineArea(int y, int n, Cell? cell, Rectangle area) → void
Inserts n lines at y within area (ansi IL semantics).
line(int y) Line?
Returns the line at y, or null if out of bounds.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
render() String
Renders buffer content to a string.
resize(int width, int height) → void
Resizes the buffer to width × height, preserving content where possible.
setCell(int x, int y, Cell? cell) → void
Sets the cell at (x, y) and updates dirty tracking.
toString() String
A string representation of this object.
override
touch(int x, int y) → void
Marks a single cell as dirty.
touchLine(int x, int y, int width) → void
width() int
The buffer width in cells.

Operators

operator ==(Object other) bool
The equality operator.
inherited