VirtualTerminalBufferInterface
An off-screen, fixed-size character grid that painted {@see TuiFrame}s are composited into, so a full retained-tree repaint can be diffed against the previously drawn buffer and only the changed rows written to the real terminal — the mechanism that makes retained-mode TUI rendering cheap enough to run every frame.
VirtualTerminalBufferInterface::width()
abstract public function width(): intThe buffer's fixed column count.
VirtualTerminalBufferInterface::height()
abstract public function height(): intThe buffer's fixed row count.
VirtualTerminalBufferInterface::writeFrame()
abstract public function writeFrame(Milpa\Live\ValueObjects\Tui\TuiBounds $bounds, Milpa\Live\ValueObjects\Tui\TuiFrame $frame): voidComposites `$frame` into this buffer at `$bounds`, overwriting the cells it covers. Implementations MUST clip silently: any part of `$frame` that falls outside this buffer's `[0, width) x [0, height)` extent is dropped rather than throwing.
Parameters
| Name | Type | Description |
|---|---|---|
| $bounds | Milpa\Live\ValueObjects\Tui\TuiBounds | |
| $frame | Milpa\Live\ValueObjects\Tui\TuiFrame |
VirtualTerminalBufferInterface::lines()
abstract public function lines(): arrayThe buffer's current contents as one string per row.
VirtualTerminalBufferInterface::diff()
abstract public function diff(self $previous): Milpa\Live\ValueObjects\Tui\TuiBufferDiffCompares this buffer's current contents against another buffer (typically the previous frame's buffer) and returns only the rows that differ, for a minimal-repaint terminal write. `self` here means "any implementation of this interface", not specifically the same concrete class — two different implementations MAY be diffed against each other as long as both answer {@see lines()}.
Parameters
| Name | Type | Description |
|---|---|---|
| $previous | self |