Skip to main content

Module patch

Module patch 

Source
Expand description

Incremental patch API: dirty tracking, grid diff, and change runs.

The patch module provides an efficient change representation so renderers (native ANSI presenter, WebGPU, trace replayer) can update incrementally.

§Architecture

Grid mutations → DirtyTracker (row + span hints)
                      ↓
GridDiff::diff_dirty(old, new, tracker) → Patch
                      ↓
Patch::runs() → Vec<ChangeRun> (for cursor-based output)
Patch::updates  → Vec<CellUpdate> (for instance-based GPU upload)

§Ordering guarantee

All outputs are in stable row-major order: row ascending, then column ascending within each row. This is deterministic for identical inputs.

Structs§

CellUpdate
A single cell update at (row, col).
ChangeRun
A contiguous horizontal span of changed cells on a single row.
DirtySpan
A half-open column range [start, end) marking dirty cells in a row.
DirtyTracker
Tracks which cells have been modified since the last frame.
GridDiff
Compute diffs between two grids.
Patch
A minimal set of changes between two grid states.