Expand description
Per-line display cache — the substrate that retires the
per-character lattice_cells::CellMatrix.
See docs/dev/architecture/display-line.md (design) and
docs/dev/operations/slice-plans/display-line.md (slices).
§What this is
A DisplayLine is the renderer-agnostic, fully-resolved display
form of one source line: the final display text (inlay hints
spliced in, tabs expanded to display width, whitespace markers
substituted), the style runs over it ([RowRun], style tags
resolved to colour by each renderer at paint), a col_map from
source bytes to inserted display columns (cursor / selection /
overlay coordinate translation), the display col_count (for
soft-wrap segment geometry), and an optional FoldHead when the
line heads a closed fold.
DisplayMatrix is the chunked, viewport-windowed,
incrementally-rebuilt cache of DisplayLines — the exact machinery
of CellMatrix (chunking, windowing, MatrixVersion, row reuse via
Arc) with the payload swapped from Vec<Cell> to DisplayLine.
Both renderers consume it directly: TUI maps text + runs to
ratatui cells; GPU shapes text once (shape_line, LineLayoutCache)
with per-run colours — no per-char intermediate, no un-bake.
§B1 scope
Types + machinery only (empty / whole_doc / chunked,
row_at_source_line, coverage, segment_count, shifted_by).
The worker build path, the shared incremental-reuse, the
always-current synchronous rebuild, and the renderer cutovers land
in B2–B4. Not consumed by any renderer yet.
Structs§
- Display
Chunk - Contiguous range of display rows covering a slice of the buffer.
Same invariants as
CellChunk:rowssorted ascending bysource_line, folded lines absent (row count is post-fold),start_source_lineis the first source line the chunk’s[start, start + chunk_size)logical range could contain. - Display
Line - The fully-resolved display form of one source line. Fields are
Arc-shared soSelf::with_source_line(the incremental-reuse shift) is a refcount bump, not a copy — mirroringCellRow. - Display
Matrix - Chunked, viewport-windowed cache of
DisplayLines. MirrorsCellMatrixexactly; only the row payload differs. - Display
Run - A style-tagged run within a
DisplayLine’stext— the per-line analogue of aCell, one per contiguous run instead of per char. The renderer resolvesstyle→ foreground colour + modifiers via the per-frame theme;flagscarries the non-style bits the cell model baked:lattice_cells::cell_flags::INLAYfor spliced inlay text,WS_MARKERfor a whitespace-marker glyph. Run lengths (len, utf-8 bytes) sum totext.len(). - Fold
Head - Closed-fold head marker carried by the first visible line of a
folded region.
folded_linesis how many source lines the fold collapses (for the┄ N lines foldedgutter / inline suffix).