Skip to content
docsv0.3.0

VirtualTerminalBuffer

A fixed grid of terminal cells that frames are composited into. Its `diff()` against the previous buffer is what makes this runtime retained rather than redrawn: only the rows it reports as changed are ever written out.

VirtualTerminalBuffer::__construct()

public function __construct(int $width, int $height, string $fill = ' '):

Parameters

Parameters of __construct()
NameTypeDescription
$widthint
$heightint
$fillstring

VirtualTerminalBuffer::width()

public function width(): int

VirtualTerminalBuffer::height()

public function height(): int

VirtualTerminalBuffer::writeFrame()

public function writeFrame(Milpa\Live\ValueObjects\Tui\TuiBounds $bounds, Milpa\Live\ValueObjects\Tui\TuiFrame $frame): void

Composites the frame into this buffer at the given bounds, overwriting the cells it covers and leaving every other cell untouched.

Parameters

Parameters of writeFrame()
NameTypeDescription
$boundsMilpa\Live\ValueObjects\Tui\TuiBounds
$frameMilpa\Live\ValueObjects\Tui\TuiFrame

VirtualTerminalBuffer::lines()

public function lines(): array

The buffer's current contents, one string per row.

VirtualTerminalBuffer::diff()

public function diff(Milpa\Live\Contracts\Tui\VirtualTerminalBufferInterface $previous): Milpa\Live\ValueObjects\Tui\TuiBufferDiff

The rows that differ from the previous buffer. An identical frame yields an empty diff, which is what makes a repaint free.

Parameters

Parameters of diff()
NameTypeDescription
$previousMilpa\Live\Contracts\Tui\VirtualTerminalBufferInterface