ScreenBuffer
Category: Terminal
Source: screen_buffer.dart
Classes
Cell
A single cell in the virtual terminal grid.
Constructor
Cell(this.char, {this.style})Properties
| Property | Type | Description |
|---|---|---|
char | String | |
style | AnsiStyle? | |
operator | bool | |
hashCode | int get | |
hashCode | int get |
ScreenBuffer
Virtual terminal buffer with diff-based rendering.
Maintains a double-buffered grid of [Cell]s. On each [flush], only cells that differ from the previous frame are written to the real terminal, eliminating flicker.
Constructor
ScreenBuffer(this._terminal)Properties
| Property | Type | Description |
|---|---|---|
width | int get | Current buffer width. |
height | int get | Current buffer height. |
width | int get | Current buffer width. |
height | int get | Current buffer height. |
Methods
void writeAt(int row, int col, String text, {AnsiStyle? style})
Write [text] into the buffer at ([row], [col]) without touching the real terminal. An optional [style] is applied to every character.
void fillRow(int row, String text, {AnsiStyle? style, int startCol = 0})
Fill an entire [row] starting at [startCol] with [text], padding with spaces to the right edge.
void clear()
Clear the current buffer (fill with spaces).
void flush()
Flush only changed cells to the real terminal.
This is the key to flicker-free rendering: we compare each cell against the previous frame and only emit ANSI sequences for cells that differ.
void resize(int width, int height)
Handle a terminal resize.