TextBuffer class

High-performance text buffer with selection support, backed by native storage.

Constructors

TextBuffer.create(int length, {WidthMethod widthMethod = WidthMethod.unicode})
Creates a TextBuffer with at least length cells, using the given widthMethod.
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
length int
Number of cells allocated in the buffer.
no setter
lineCount int
Number of lines tracked by the buffer (call finalizeLineInfo first).
no setter
lineStarts List<int>
Zero-based start indices for each line (requires finalized line info).
no setter
lineWidths List<int>
Display widths for each line (requires finalized line info).
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

dispose() → void
Releases all native resources held by this buffer.
finalizeLineInfo() → void
Finalize line metadata after writing content.
getDirectAccess() DirectTextAccess
Get direct access to internal arrays for performance-critical operations.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reset() → void
Reset the buffer content while preserving capacity.
resetSelection() → void
Clears the current selection, removing any highlight.
setCell(int index, String char, Color fg, Color bg, int attributes) → void
Sets the cell at index to the given character, colors, and attributes.
setSelection(int start, int end, Color bgColor, Color fgColor) → void
Sets the selected cell range from start to end with the given highlight colors.
toString() String
A string representation of this object.
inherited
writeChunk(String text, Color fg, Color bg, int attributes) int
Writes text to the buffer at the current write position, returning the number of cells written.

Operators

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