Skip to main content

Module layout_cache

Module layout_cache 

Source
Expand description

Per-version viewport cache for highlight/conceal/link inputs. Per-version viewport cache for expensive per-line inputs.

highlight_line (pulldown parse), ConcealedLine::build, and extract_links are pure in (buffer version, highlighter revision, row, active-row flag, line text) but were recomputed for every visible row on every prepaint and again on every hit-test (offset_for_position). This cache computes each row once per epoch and shares it across prepaint, hover, and click paths.

Deliberately not cached here: shape_text output (WrappedLine is neither Clone nor reconstructible via public GPUI API) and TextRuns (depend on the live selection). Glyph layout itself is already deduped inside GPUI’s line_layout_cache across consecutive frames.

Structs§

CachedInput
Owned per-line inputs shared by prepaint and hit-testing.
LayoutCache
Viewport input cache keyed by buffer version + highlighter revision.