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
| Name | Type | Description |
|---|---|---|
| $width | int | |
| $height | int | |
| $fill | string |
VirtualTerminalBuffer::width()
public function width(): intVirtualTerminalBuffer::height()
public function height(): intVirtualTerminalBuffer::writeFrame()
public function writeFrame(Milpa\Live\ValueObjects\Tui\TuiBounds $bounds, Milpa\Live\ValueObjects\Tui\TuiFrame $frame): voidComposites the frame into this buffer at the given bounds, overwriting the cells it covers and leaving every other cell untouched.
Parameters
| Name | Type | Description |
|---|---|---|
| $bounds | Milpa\Live\ValueObjects\Tui\TuiBounds | |
| $frame | Milpa\Live\ValueObjects\Tui\TuiFrame |
VirtualTerminalBuffer::lines()
public function lines(): arrayThe buffer's current contents, one string per row.
VirtualTerminalBuffer::diff()
public function diff(Milpa\Live\Contracts\Tui\VirtualTerminalBufferInterface $previous): Milpa\Live\ValueObjects\Tui\TuiBufferDiffThe rows that differ from the previous buffer. An identical frame yields an empty diff, which is what makes a repaint free.
Parameters
| Name | Type | Description |
|---|---|---|
| $previous | Milpa\Live\Contracts\Tui\VirtualTerminalBufferInterface |