pub struct DisplayMatrix {
pub chunks: Arc<[Arc<DisplayChunk>]>,
pub chunk_size: u32,
pub source_line_count: u32,
pub visible_line_count: u32,
pub version: MatrixVersion,
pub wrap_width: u32,
pub reveal_line: Option<u32>,
}Expand description
Chunked, viewport-windowed cache of DisplayLines. Mirrors
CellMatrix exactly; only the row payload differs.
Fields§
§chunks: Arc<[Arc<DisplayChunk>]>Chunks ordered by start_source_line. Whole-doc mode has one.
chunk_size: u32Logical lines per chunk, or CHUNK_SIZE_WHOLE_DOC for
whole-doc mode.
source_line_count: u32Total logical lines in the source buffer (pre-fold).
visible_line_count: u32Total display rows across all chunks (post-fold).
version: MatrixVersionComponent-wise version captured at build time.
wrap_width: u32Soft-wrap column width, or 0 when wrapping is off (one display
row per source line). Stamped by the worker from the pane width.
reveal_line: Option<u32>CL.1: the line this matrix was built with its conceals suppressed on.
Carried on the matrix rather than folded into MatrixVersion on
purpose. The version is the cache-hit key, and the reveal line moves
with the CURSOR — folding it in would invalidate the whole matrix on
every j, turning a 47 ns cache hit into a ~1.5 ms window rebuild.
Kept beside the version instead, so the worker can see the reveal moved
and rebuild exactly the two rows that changed.
Implementations§
Source§impl DisplayMatrix
impl DisplayMatrix
pub fn empty() -> Self
pub fn chunked( chunks: impl Into<Arc<[Arc<DisplayChunk>]>>, chunk_size: u32, source_line_count: u32, version: MatrixVersion, ) -> Self
pub fn whole_doc(chunk: Arc<DisplayChunk>, source_line_count: u32) -> Self
pub fn is_whole_doc(&self) -> bool
pub fn is_empty(&self) -> bool
Sourcepub fn segment_count(&self, target: u32) -> u32
pub fn segment_count(&self, target: u32) -> u32
How many display rows source line target occupies under
soft-wrap (1 when wrapping off / line missing / folded).
Sourcepub fn covered_start_line(&self) -> u32
pub fn covered_start_line(&self) -> u32
First source line the chunks were built to cover (0 for
whole-doc / full-coverage chunked; the window lower bound when
windowed). H.3 coverage semantics, ported.
Sourcepub fn covered_end_line(&self) -> u32
pub fn covered_end_line(&self) -> u32
Exclusive upper bound of the covered source-line range.
Sourcepub fn covers(&self, lo: u32, hi: u32) -> bool
pub fn covers(&self, lo: u32, hi: u32) -> bool
Does the matrix cover all of [lo, hi)? Empty matrix covers
nothing. Drives the worker cache-hit / window-extend gate.
Sourcepub fn row_at_source_line(&self, target: u32) -> Option<&DisplayLine>
pub fn row_at_source_line(&self, target: u32) -> Option<&DisplayLine>
Row whose source_line == target, walking chunks in order.
None when folded or outside coverage (the renderer falls back
to its rope/plain path only transiently, off-window).
Trait Implementations§
Source§impl Clone for DisplayMatrix
impl Clone for DisplayMatrix
Source§fn clone(&self) -> DisplayMatrix
fn clone(&self) -> DisplayMatrix
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 DisplayMatrix
impl Debug for DisplayMatrix
Auto Trait Implementations§
impl Freeze for DisplayMatrix
impl RefUnwindSafe for DisplayMatrix
impl Send for DisplayMatrix
impl Sync for DisplayMatrix
impl Unpin for DisplayMatrix
impl UnsafeUnpin for DisplayMatrix
impl UnwindSafe for DisplayMatrix
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