Skip to main content

display_line_to_source_spans

Function display_line_to_source_spans 

Source
pub fn display_line_to_source_spans(
    line: &DisplayLine,
    resolved: &ResolvedTheme,
    ids: &BuiltinElementIds,
) -> Vec<Span<'static>>
Expand description

B2.4 (2026-06-04): the DisplayLine analogue of [cell_row_to_source_spans] — the TUI’s source of document-body spans once it consumes the canonical DisplayMatrix directly instead of the projected cell grid. Walks line.runs, drops INLAY runs (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 syntax style + flags → a ratatui [Style] via the host theme.

Resolution parity. This reproduces the worker’s display_line_to_cell_row projection byte-for-byte so the cutover is visually invisible: style → fg via theme.syntax_style(..).fg (→ to_rgb_u32); a WS_TRAILING marker run takes theme.whitespace_trailing_style fg; modifiers come from the host theme’s per-style Modifiers. fg 0 maps to None (pane default), exactly as the cell path’s fg == 0. Runs are grouped by the resolved ratatui style, so two runs with distinct syntax tags but identical resolved colour merge — matching the cell path, which grouped on resolved (fg, bg, mods).

Returns an empty Vec for an empty line or one that is entirely inlay runs.