pub struct MatrixVersion {
pub text: u64,
pub syntax: u64,
pub inlay_hints: u64,
pub folds: u64,
pub theme: u64,
pub whitespace: u64,
pub indent: u64,
pub conceal: u64,
}Expand description
Per-source version stamps that drive matrix rebuild decisions.
Decoration kinds that don’t change cell content (cursor,
selection, hlsearch, diagnostics, doc highlights, search matches)
deliberately don’t appear here — they live in OverlayState
(defined in lattice-host in S2) and are read by the paint loop
each frame without triggering matrix work.
Fields are u64 to match the source counters/hashes in
lattice-host (document.text_version(),
compute_fold_hash, inlay_hints_version, etc.) — no lossy
cast at the boundary.
Fields§
§text: u64Source of truth: document.text_version(). Monotonic.
syntax: u64Source of truth: content stamp of the syntax span set covering the buffer. Hash-style (not monotonic).
inlay_hints: u64Source of truth: inlay_hints_version(&inlays). Hash-style.
folds: u64Source of truth: compute_fold_hash(&folds). Hash-style.
theme: u64Source of truth: theme palette revision. Monotonic in practice (theme replacements are discrete events).
whitespace: u642026-05-27: display.whitespace.* snapshot hash. Bumps
when display.show_whitespace toggles or any of the
display.whitespace.* glyphs change. The cell-builder
substitutes whitespace bytes with marker glyphs + the
WS_MARKER flag at emission time, so the glyph ends up
in Cell.ch — folding the config into this axis
invalidates the cached matrix when the user re-configures.
indent: u64IG.2 (2026-08-16): shiftwidth + the display.indent-guides.*
snapshot hash. Indentation guides are built beside the display
matrix from the same snapshot, so they need an axis that makes
the worker rebuild when their inputs change.
Deliberately NOT folded into Self::whitespace, even though
both are display-config axes: renderers gate painting on the
whitespace axis (a mismatch drops the viewport to raw text for a
frame), and toggling guides must not cost a whole-viewport
fallback when the display text is not affected at all. This axis
gates the rebuild only — like syntax, folds and theme.
conceal: u64H.3 (2026-08-29): the conceal inputs — the buffer language’s
rule set plus whether the modal state reveals (H.4). Bumps when
either moves. See docs/dev/architecture/conceal.md.
Painting-class, like whitespace and unlike indent. The
distinction is on indent above: conceal changes the display
text, so a renderer painting a matrix stamped with a stale
conceal axis would show the wrong characters, not merely a
missing decoration. A mismatch therefore drops the viewport to
raw text for one frame — which is the correct degradation, and
is the same frame the mode transition was going to repaint.
Constant for every buffer whose language declares no rules.
That is what keeps i in a Rust file from costing a viewport
rebuild: the axis cannot move if there is nothing to conceal.
Implementations§
Source§impl MatrixVersion
impl MatrixVersion
Sourcepub fn differs_from(&self, other: &Self) -> bool
pub fn differs_from(&self, other: &Self) -> bool
true when any component differs from other. Used by the
cell-builder worker to decide if a cached chunk’s version
is stale relative to the current RenderState version. Works
uniformly across monotonic and hash-style axes.
Sourcepub fn differing_axes(&self, other: &Self) -> Vec<&'static str>
pub fn differing_axes(&self, other: &Self) -> Vec<&'static str>
The names of the axes that differ, for logging.
A stale-render report is always the same question — the matrix did not
rebuild, so WHICH invalidation axis failed to move? Answering it from
two opaque version structs means eyeballing seven u64s in a log line;
answering it from ["syntax"] is immediate. Allocates, so it is only
ever called from a debug! argument that a disabled level never
evaluates.
Trait Implementations§
Source§impl Clone for MatrixVersion
impl Clone for MatrixVersion
Source§fn clone(&self) -> MatrixVersion
fn clone(&self) -> MatrixVersion
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more