Buffer class
A 2D grid of cell data stored in parallel flat lists.
- Implementers
- Available extensions
Constructors
Properties
- activeClip → Rect
-
Returns the current active clip rectangle, defaulting to full buffer bounds if stack is empty.
no setter
- attributes ↔ Uint32List
-
Single unified data array for fg, bg, and modifiers.
layout:
fg, bg, mod, fg, bg, mod...getter/setter pair -
characters
↔ List<
String> -
Flat list of characters representing the grid.
getter/setter pair
- defaultBlend → bool
-
Whether cell attribute writes alpha-blend colors over existing cells when
a per-call
blendargument is omitted.final -
effects
→ List<
RegisteredEffect> -
The list of terminal effects registered in this buffer.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasKittyImages → bool
-
Whether any Kitty image is registered in KittyImageRegistry.global or a
scoped registry attached to this buffer.
no setter
- hasUnderlineColors → bool
-
Whether any cell in this buffer has a non-zero custom underline color.
no setter
- hasUris → bool
-
Whether any cell in this buffer has a non-null OSC 8 hyperlink URI.
no setter
- height ↔ int
-
The height of the buffer in rows.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
selectableRegions
→ List<
Rect> -
Selectable sub-regions registered during the current paint pass.
final
- width ↔ int
-
The width of the buffer in columns.
getter/setter pair
Methods
-
addEffect(
RegisteredEffect effect) → void - Adds a terminal effect to this buffer.
-
cellsEqual(
int x, int y, Buffer other, int ox, int oy) → bool -
Whether all cell channels (
char,fg,bg,modifiers,underlineColor,uri) at (x,y) matchotherat (ox,oy). -
clear(
) → void - Resets all cells in the buffer to transparent empty cells.
-
clearCellAuxRange(
int start, int end) → void -
Clears SGR 58 underline colors and OSC 8 URIs across
[start, end). -
clearMetadata(
) → void - Clears overlay metadata lists (effects, selectable regions, and scoped Kitty image registries) without clearing cell character/attribute arrays.
-
copyCellAuxAt(
Buffer source, int dstIdx, int srcIdx) → void -
Copies SGR 58 underline color and OSC 8 URI from
sourceatsrcIdxtodstIdx. -
copyCellAuxRangeFrom(
Buffer source, int dstStart, int srcStart, int count) → void -
Copies
[srcStart, srcStart + count)auxiliary attributes fromsourceto[dstStart, dstStart + count). -
drawCautionTape(
Rect rect, int offsetX, int offsetY) → void - Draws a patterned caution tape in the specified rectangular bounds.
-
fillAttributes(
{String? char, int? fg, int? bg, int? modifiers, int? underlineColor, String? uri, bool? blend}) → void - Fills the entire buffer with the specified attributes.
-
fillBackgroundStyle(
Rect bounds, Style style, BlendOption blend) → void -
Available on Buffer, provided by the EffectHelpers extension
Fills the background style of all cells inboundsusingblend. -
fillForegroundStyle(
Rect bounds, Style style, BlendOption blend) → void -
Available on Buffer, provided by the EffectHelpers extension
Fills the foreground style of all cells inboundsusingblend. -
fillRect(
Rect rect, {String? char, int? fg, int? bg, int? modifiers, int? underlineColor, String? uri, bool? blend}) → void - Fills a rectangular region with the given character and attributes.
-
getBackground(
int x, int y) → int -
Gets the background color at (
x,y). Returns 0 if coordinates are out of bounds. -
getCharacter(
int x, int y) → String -
Gets the character at (
x,y). Returns a space if coordinates are out of bounds. -
getForeground(
int x, int y) → int -
Gets the foreground color at (
x,y). Returns 0 if coordinates are out of bounds. -
getModifiers(
int x, int y) → int -
Gets the modifiers at (
x,y). Returns transparent if coordinates are out of bounds. -
getUnderlineColor(
int x, int y) → int -
Gets the SGR 58 underline color at (
x,y), or0when using the foreground color. -
getUnderlineColorAt(
int cellIdx) → int -
Gets the SGR 58 underline color at flat index
cellIdx(0when unset). -
getUri(
int x, int y) → String? -
Gets the OSC 8 hyperlink URI at (
x,y), ornullwhen no link is set. -
getUriAt(
int cellIdx) → String? -
Gets the OSC 8 hyperlink URI at flat index
cellIdx(nullwhen unset). -
isCellValid(
int x, int y) → bool -
Whether cell (
x,y) is valid and inside the current active clip bounds. -
lookupKittyImage(
int x, int y, int imageId) → KittyImageData? -
Looks up
imageIdusing any scoped KittyImageRegistry covering (x,y), falling back to KittyImageRegistry.global only outside scoped regions. -
lookupKittyRegistry(
int x, int y) → KittyImageRegistry -
Resolves the active KittyImageRegistry covering (
x,y), falling back to KittyImageRegistry.global outside scoped regions. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
popClip(
) → void - Pops the most recently pushed clip rectangle from the stack.
-
propagateMetadataFrom(
Buffer source, {int dx = 0, int dy = 0, Rect? clip, int? zIndex}) → void -
Propagates region metadata (
effects,selectableRegions, and scoped KittyImageRegistry bounds) fromsourcetranslated by (dx,dy) and clipped toclip(or activeClip). -
pushClip(
Rect clipRect) → void - Pushes a new clip rectangle onto the stack, intersecting it with the current active clip.
-
registerKittyRegistry(
Rect bounds, KittyImageRegistry registry) → void -
Registers a pane-scoped KittyImageRegistry for cells within
bounds. -
registerSelectableRegion(
Rect region, {int zIndex = 0}) → void -
Registers a selectable rectangular
regionin buffer coordinates with optionalzIndex. -
resize(
int newWidth, int newHeight) → void - Resizes the buffer to the new dimensions, preserving existing content where it fits.
-
rotateColumn(
Rect bounds, int colIndex, int amount) → void -
Available on Buffer, provided by the EffectHelpers extension
Rotates a specific column within the given bounds byamountdownward. -
rotateRow(
Rect bounds, int rowIndex, int amount) → void -
Available on Buffer, provided by the EffectHelpers extension
Rotates a specific row within the given bounds byamountrightward. -
selectableRegionZIndexAt(
int index) → int -
Layer z-index recorded for
selectableRegions[index](0by default). -
setAttributes(
int x, int y, {String? char, int? fg, int? bg, int? modifiers, int? underlineColor, String? uri, bool? blend}) → void -
Sets the cell attributes at (
x,y). Does nothing if coordinates are out of bounds. -
setBackground(
int x, int y, int bg) → void - Sets background color at coordinates.
-
setCell(
int x, int y, String char, int fg, int bg, int mod, {bool? blend, int underlineColor = 0, String? uri}) → void - Sets character, colors, and modifiers at coordinates.
-
setCharacter(
int x, int y, String char) → void - Sets character at coordinates.
-
setForeground(
int x, int y, int fg) → void - Sets foreground color at coordinates.
-
setModifiers(
int x, int y, int mod) → void - Sets modifiers at coordinates.
-
setUnderlineColor(
int x, int y, int ulColor) → void -
Sets the SGR 58 underline color at (
x,y) (0resets to default foreground). -
setUnderlineColorAt(
int cellIdx, int ulColor) → void -
Sets the SGR 58 underline color at flat index
cellIdx. -
setUri(
int x, int y, String? uri) → void -
Sets the OSC 8 hyperlink URI at (
x,y) (nullclears the link). -
setUriAt(
int cellIdx, String? uri) → void -
Sets the OSC 8 hyperlink URI at flat index
cellIdx. -
sliceUnderlineColors(
int start, int end) → Uint32List? -
Copies non-empty SGR 58 underline colors across
[start, end), ornullif all0. -
sliceUris(
int start, int end) → List< String?> ? -
Copies non-empty OSC 8 URIs across
[start, end), ornullif allnull. -
toAnsiString(
{bool trimTrailingSpaces = true, bool resetLineEndings = false}) → String -
Available on Buffer, provided by the BufferAnsiSerialization extension
Serializes this Buffer grid into an ANSI escape sequence string. -
toString(
) → String -
A string representation of this object.
inherited
-
writeCellAuxSlices(
int dstStart, int count, {Uint32List? underlineColors, List< String?> ? uris}) → void -
Writes optional
underlineColorsandurisslices into[dstStart, dstStart + count). -
writeString(
int x, int y, String text, Style style) → void -
Writes styled
textto the buffer starting at (x,y).
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited