pub struct CellsRenderState {Show 18 fields
pub matrix: Arc<ArcSwap<CellMatrix>>,
pub version: MatrixVersion,
pub snapshot: Option<Arc<DocumentSnapshot>>,
pub syntax_handle: Option<Arc<SyntaxHandle>>,
pub inlay_hints: Arc<[InlayHintRow]>,
pub folds: Arc<[Fold]>,
pub viewport_height: u32,
pub foldenable: bool,
pub last_edit: Option<EditDelta>,
pub resolved_theme: Arc<ResolvedTheme>,
pub theme_ids: BuiltinElementIds,
pub whitespace: WhitespaceConfig,
pub panes: Arc<[PaneCellsInputs]>,
pub pane_matrices: Arc<HashMap<PaneId, Arc<ArcSwap<CellMatrix>>>>,
pub display_matrix: Arc<ArcSwap<DisplayMatrix>>,
pub display_pane_matrices: Arc<HashMap<PaneId, Arc<ArcSwap<DisplayMatrix>>>>,
pub pane_indent_guides: Arc<HashMap<PaneId, Arc<ArcSwap<IndentGuides>>>>,
pub pane_sticky_context: Arc<HashMap<PaneId, Arc<ArcSwap<StickyContext>>>>,
}Expand description
Cell-grid renderer substrate state. Mirror of
SyntaxRenderState in shape (wait-free output cell + read
inputs); replaces the per-frame shape_line path for
code-class buffers.
S2.1: only the plumbing is in place — matrix is published
but stays empty until S2.2 spawns the cell-builder worker that
will write to it. The other fields are populated from current
Editor state by build_render_state so the worker has its
full input set the moment it lands.
Fields§
§matrix: Arc<ArcSwap<CellMatrix>>Worker-published output cell. Inner Arc identity stays
stable across publishes (cloned from
Editor::cells_matrix_cell) so the worker’s writes
survive subsequent publishes — same stability pattern as
[SyntaxRenderState::visible_spans].
version: MatrixVersionAggregate version stamp of the inputs below. Worker
compares against the published matrix’s
lattice_cells::CellMatrix::version to decide rebuild —
see lattice_cells::MatrixVersion::differs_from. Folds
text_version, syntax-derived stamp, inlay_hints
content hash, folds content hash, and theme version
into one comparison value.
snapshot: Option<Arc<DocumentSnapshot>>Active document snapshot. The cell-builder walks this
line-by-line. None when no document is active (initial
boot or between buffer switches). Cloned by reference from
the active RopeDocumentHandle.snapshot() at publish time.
syntax_handle: Option<Arc<SyntaxHandle>>Active buffer’s syntax handle. Consumed by S2.3 cell
construction to resolve per-cell foreground colour from
the syntax span set. None when no language is attached
— cells fall back to the theme default fg.
inlay_hints: Arc<[InlayHintRow]>Pre-flattened inlay hints for the active buffer. Same
payload as SyntaxRenderState::inlay_hints; carried
here so the cell-builder can splice inlay text into cells
without re-reading the LSP cache (S2.3).
folds: Arc<[Fold]>Active buffer’s fold ranges. Consumed by S2.3 for row elision (folded source lines do not produce matrix rows).
viewport_height: u32Visible pane height in matrix rows. S2.4 reads this to
pick chunk_size = 2 × viewport_height when above the
whole-doc-mode threshold.
foldenable: bool:set foldenable for the active buffer. The cell-builder
feeds this into crate::folds::FoldIndex::from_folds so
elision predicates collapse to false when folding is off
— zi then yields the unfolded matrix without a separate
code path. Folded into lattice_cells::MatrixVersion::folds
at publish time so toggling foldenable invalidates the
matrix.
last_edit: Option<EditDelta>S2.4.b (2026-05-26): single-edit delta covering the bump
from the previous publish’s text_version to this publish’s
text_version. Some(d) when exactly one
apply_edit_blocking happened since the last build and the
worker can take the incremental rebuild path; None
otherwise (no edit, batch, undo / redo, multi-edit
coalescing) — in which case the worker conservatively
full-rebuilds. Sourced from Editor::last_edit_for_cells
via take() at build_render_state time, so subsequent
publishes without further edits see None.
resolved_theme: Arc<ResolvedTheme>T.5 (theme-system): the resolved read table + builtin ids the
cell-builder uses to resolve each span’s lattice_syntax::Style
→ resolved.get(syntax_element_id(ids, s)) (O(1) array index).
Snapshotted at publish. T.6.t deleted the flat host Theme field
that used to ride alongside it; the matrix invalidation key
(MatrixVersion::theme) is now ResolvedTheme::version(), set at
build_render_state time, so a palette change still rebuilds the
matrix with fresh colours.
theme_ids: BuiltinElementIds§whitespace: WhitespaceConfig2026-05-27: display.whitespace.* snapshot. Worker
substitutes whitespace bytes with marker glyphs +
WS_MARKER flag when show is true. A hash of this
struct is folded into
lattice_cells::MatrixVersion::whitespace at publish
time so any :set of a whitespace option invalidates the
matrix and triggers a rebuild.
panes: Arc<[PaneCellsInputs]>D.4.d.1.a (2026-05-29): one entry per visible Document
pane. Populated by publish_render_state from
pane_tree.leaves(); non-Document leaves are skipped.
D.4.d.1.b consumes this slice in
crate::cells_worker::recompute — each entry’s
matrix is the per-buffer registry cell the worker
writes through. The active pane’s entry shares Arc
identity with Self::matrix so today’s renderer
read path keeps landing on the worker’s writes for
the active pane; Self::pane_matrices +
Self::matrix_for_pane are the per-pane read
surface renderers can use to find a non-active pane’s
matrix without iterating panes.
pane_matrices: Arc<HashMap<PaneId, Arc<ArcSwap<CellMatrix>>>>D.4.d.1.c (2026-05-29): PaneId → matrix lookup
derived from Self::panes at publish time so
renderers can find a pane’s matrix by id without
scanning the panes slice. One entry per visible
Document leaf; non-Document panes are absent (the
renderer’s per-kind dispatch already knows not to
consult cells for those).
Use Self::matrix_for_pane for the read; direct
access to the map is fine when batching multiple
lookups.
display_matrix: Arc<ArcSwap<DisplayMatrix>>B2.1 (2026-06-04): active-pane per-line display matrix.
Clone of Editor::display_matrix_cell (stable Arc identity so
the worker’s writes survive subsequent publishes) — the
per-line analogue of Self::matrix. Empty until the B2.2
worker build path writes through it. See
docs/dev/architecture/display-line.md.
display_pane_matrices: Arc<HashMap<PaneId, Arc<ArcSwap<DisplayMatrix>>>>B2.1 (2026-06-04): PaneId → display matrix lookup, the
per-line analogue of Self::pane_matrices. One entry per
visible Document leaf; derived at publish time from
Self::panes. Read via Self::display_matrix_for_pane.
pane_indent_guides: Arc<HashMap<PaneId, Arc<ArcSwap<IndentGuides>>>>IG.2 (2026-08-16): PaneId → indentation guides, the peer of
Self::display_pane_matrices and derived from the same
panes list at publish time. Read via
Self::indent_guides_for_pane.
pane_sticky_context: Arc<HashMap<PaneId, Arc<ArcSwap<StickyContext>>>>TC.3b: PaneId → sticky context, the peer of
Self::pane_indent_guides, derived from the same panes list at
publish time. Read via Self::sticky_context_for_pane.
Implementations§
Source§impl CellsRenderState
impl CellsRenderState
Sourcepub fn display_matrix_for_pane(
&self,
pane_id: PaneId,
) -> Option<&Arc<ArcSwap<DisplayMatrix>>>
pub fn display_matrix_for_pane( &self, pane_id: PaneId, ) -> Option<&Arc<ArcSwap<DisplayMatrix>>>
B2.1 (2026-06-04): look up the per-line display matrix for
pane_id. None when the pane is not a Document leaf (same
semantics as Self::matrix_for_pane).
Sourcepub fn indent_guides_for_pane(
&self,
pane_id: PaneId,
) -> Option<&Arc<ArcSwap<IndentGuides>>>
pub fn indent_guides_for_pane( &self, pane_id: PaneId, ) -> Option<&Arc<ArcSwap<IndentGuides>>>
IG.2 (2026-08-16): the indentation-guide layer for pane_id.
None for a pane with no display matrix (non-Document leaves
skip the cells path), which is the correct “no guides” answer.
Sourcepub fn sticky_context_for_pane(
&self,
pane_id: PaneId,
) -> Option<&Arc<ArcSwap<StickyContext>>>
pub fn sticky_context_for_pane( &self, pane_id: PaneId, ) -> Option<&Arc<ArcSwap<StickyContext>>>
TC.3b: look up the pinned context strip for pane_id. None when the
pane is not a document-backed leaf (it then pins nothing).
Sourcepub fn matrix_for_pane(
&self,
pane_id: PaneId,
) -> Option<&Arc<ArcSwap<CellMatrix>>>
pub fn matrix_for_pane( &self, pane_id: PaneId, ) -> Option<&Arc<ArcSwap<CellMatrix>>>
D.4.d.1.c: look up the cell matrix for pane_id.
Returns None when the pane is not a Document leaf
(file tree / help / messages / oil / terminal panes
skip the cells path entirely — see
crate::dispatch::Editor::build_cells_panes).
Sourcepub fn whitespace_version_for_pane(&self, pane_id: PaneId) -> u64
pub fn whitespace_version_for_pane(&self, pane_id: PaneId) -> u64
The current whitespace-axis stamp for pane_id — what a
matrix built right now would carry. A renderer compares it
against the matrix it is about to paint from
(lattice_cells::MatrixVersion::whitespace); a mismatch means
the cells were emitted under a different display.whitespace.*
configuration and their decoration is wrong until the worker
rebuilds.
Falls back to the top-level aggregate when the pane has no entry (non-Document leaf, or a publish gap) — that stamp is computed from the same option fields, so the comparison stays meaningful rather than silently passing.
Sourcepub fn wrap_width_for_pane(&self, pane_id: PaneId) -> u32
pub fn wrap_width_for_pane(&self, pane_id: PaneId) -> u32
CV.4: the soft-wrap column width for pane_id derived from
live published geometry — viewport_width minus the
gutter reservation, or 0 when the pane does not wrap.
This is the value the cells worker will stamp onto the matrix
as wrap_width, computed from the same two published inputs,
and therefore available a frame before the worker runs. A
renderer that reads the matrix’s stamp instead paints
unwrapped until the worker catches up: on a freshly opened
file, right after a resize, and on the keystroke that ran
:set wrap. Reading it here keeps both peers and the host’s
scroll clamp on one number.
0 for a pane with no published entry (non-Document leaves
skip the cells path), which is the correct “no wrapping”
answer for them.
Trait Implementations§
Source§impl Clone for CellsRenderState
impl Clone for CellsRenderState
Source§fn clone(&self) -> CellsRenderState
fn clone(&self) -> CellsRenderState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CellsRenderState
impl Debug for CellsRenderState
Auto Trait Implementations§
impl !RefUnwindSafe for CellsRenderState
impl !UnwindSafe for CellsRenderState
impl Freeze for CellsRenderState
impl Send for CellsRenderState
impl Sync for CellsRenderState
impl Unpin for CellsRenderState
impl UnsafeUnpin for CellsRenderState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more