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< cellLines)Cell> > -
Creates a buffer from pre-built cells without applying
Line.set().factory
Properties
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
areainto a new buffer, or returns null if out-of-bounds. -
deleteCell(
int x, int y, int n, Cell? cell) → void -
Deletes
ncells at (x,y) within full bounds (ansi DCH semantics). -
deleteCellArea(
int x, int y, int n, Cell? cell, Rectangle area) → void -
Deletes
ncells at (x,y) withinarea(ansi DCH semantics). -
deleteLine(
int y, int n, Cell? cell) → void -
Deletes
nlines atywithin full bounds. -
deleteLineArea(
int y, int n, Cell? cell, Rectangle area) → void -
Deletes
nlines atywithinarea(ansi DL semantics). -
draw(
Screen screen, Rectangle area) → void -
Draws this buffer onto
screenat the specifiedarea. -
fill(
Cell? cell) → void -
Fills the buffer with
cellover its full bounds. -
fillArea(
Cell? cell, Rectangle area) → void -
Fills the buffer with
cellwithinarea. -
height(
) → int - The buffer height in cells.
-
insertCell(
int x, int y, int n, Cell? cell) → void -
Inserts
ncells at (x,y) within full bounds (ansi ICH semantics). -
insertCellArea(
int x, int y, int n, Cell? cell, Rectangle area) → void -
Inserts
ncells at (x,y) withinarea(ansi ICH semantics). -
insertLine(
int y, int n, Cell? cell) → void -
Inserts
nlines atywithin full bounds. -
insertLineArea(
int y, int n, Cell? cell, Rectangle area) → void -
Inserts
nlines atywithinarea(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