Expand description
B2.4 (2026-06-04): DisplayMatrix → ratatui span conversion.
The TUI consumes the canonical
lattice_host::display_matrix::DisplayMatrix published by the
cells worker and emits a Vec<Span<'static>> ready for ratatui’s
text widgets. This module is the substrate→TUI translation layer.
§Why a separate module
A DisplayLine carries style-tagged byte runs
(lattice_host::display_matrix::DisplayRun: a
lattice_syntax::Style enum + non-style flag bits), NOT resolved
colours — the renderer resolves style → fg + modifiers against the
host theme at paint (truecolor Color::Rgb, or ratatui’s
nearest-named downsample in low-colour terminals).
display_line_to_source_spans walks the runs, drops INLAY runs
so the spans cover source bytes one-to-one with the rope line (the
overlay pipeline positions overlays by source-byte offset), groups
consecutive runs with the same resolved style, and emits one
[ratatui::text::Span] per group.
Pre-B2.4 this module converted the projected per-character cell grid
(cell_row_to_source_spans); B2.4a cut the TUI over to the
DisplayMatrix and B2.4b deleted the cell→span path. The remaining
cell path (worker projection, GPU reader) goes away in B3/B4.
Functions§
- display_
line_ to_ source_ spans - B2.4 (2026-06-04): the
DisplayLineanalogue of [cell_row_to_source_spans] — the TUI’s source of document-body spans once it consumes the canonicalDisplayMatrixdirectly instead of the projected cell grid. Walksline.runs, dropsINLAYruns (so the spans cover source bytes one-to-one with the rope line — overlays positioned by source byte work unchanged), and resolves each run’s syntaxstyle+ flags → a ratatui [Style] via the host theme.