Skip to content
docsv0.3.0

TuiBufferDiff

The set of rows that changed between two {@see \Milpa\Live\Contracts\Tui\VirtualTerminalBufferInterface} states, as produced by {@see \Milpa\Live\Contracts\Tui\VirtualTerminalBufferInterface::diff()} — the minimal-repaint unit the TUI runtime writes to the real terminal.

TuiBufferDiff::__construct()

public function __construct(array $changes):

Parameters

Parameters of __construct()
NameTypeDescription
$changesarray<int, array{row: int, line: string}>Changed rows, each the row's 0-based index and its full new line content.

TuiBufferDiff::isEmpty()

public function isEmpty(): bool

Whether nothing changed (no rows to repaint).

TuiBufferDiff::renderAnsiPatch()

public function renderAnsiPatch(): string

Renders this diff as an ANSI escape sequence that repositions the cursor to each changed row (1-based, column 1) and writes its new content — a minimal patch suitable for writing directly to a real terminal instead of redrawing the full screen.