pub struct DisplayLine {
pub source_line: u32,
pub text: Arc<str>,
pub runs: Arc<[DisplayRun]>,
pub col_map: Arc<[(u32, u32)]>,
pub conceals: Arc<[ConcealRange]>,
pub col_count: u32,
pub fold: Option<FoldHead>,
}Expand description
The fully-resolved display form of one source line. Fields are
Arc-shared so Self::with_source_line (the incremental-reuse
shift) is a refcount bump, not a copy — mirroring CellRow.
Fields§
§source_line: u32Logical (pre-fold) source line this row renders.
text: Arc<str>Final display string: inlays spliced, tabs expanded to display width, whitespace markers substituted.
runs: Arc<[DisplayRun]>Style-tagged byte runs partitioning text left-to-right.
Run lengths sum to text.len(). See DisplayRun.
col_map: Arc<[(u32, u32)]>(source_byte, extra_display_cols) breakpoints: at each source
byte, how many extra display columns were inserted ahead of it
(inlay text + tab expansion). Drives source-byte ↔ display-col
translation. Same shape as CellRow::inlay_offsets.
conceals: Arc<[ConcealRange]>H.1: source-byte ranges this line hides — [start, end),
sorted ascending and non-overlapping (the builder coalesces
before storing; two overlapping ranges would have their
shared width subtracted twice and every column past them
would be wrong).
A hidden range occupies zero display columns and its bytes
are absent from Self::text, so this is what lets a
source position still be located: see
lattice_cells::source_byte_to_display_col. Empty for
every line of a buffer whose language declares no conceal
rules, which is the path that must stay free.
Deliberately NOT folded into Self::col_map as a signed
delta. col_map’s columns are already char-resolved, so a
hidden range removes exactly end - start of them — the
width is derivable from the range and a second encoding of
it could only ever disagree with the first.
col_count: u32Display width in columns (char count of text). Soft-wrap
geometry reads this via DisplayMatrix::segment_count.
fold: Option<FoldHead>Some when this line heads a closed fold.
Implementations§
Source§impl DisplayLine
impl DisplayLine
Sourcepub fn with_source_line(&self, source_line: u32) -> Self
pub fn with_source_line(&self, source_line: u32) -> Self
Clone with a new source_line; all payload Arcs are shared
(refcount bump only). Used by the incremental-rebuild shift for
lines past an edit whose content is unchanged.
Sourcepub fn byte_to_combined_col(&self, byte: u32) -> u32
pub fn byte_to_combined_col(&self, byte: u32) -> u32
Map a source byte (already char-resolved) → combined display
column for this line. Returns the column after any inlay /
tab-expansion columns inserted at or before byte. The
DisplayLine analogue of CellRow::byte_to_combined_col; both
walk the same (orig_byte, extra_cols) breakpoint list
(col_map here, inlay_offsets there), so overlay / cursor
positioning is identical across the cell and display substrates.
col_map is sorted ascending by orig_byte (build invariant),
so the walk can stop at the first breakpoint past byte.
H.1: also subtracts Self::conceals, and a byte falling
inside a hidden range resolves to that range’s start column.
The arithmetic lives in lattice_cells::source_byte_to_display_col
rather than here because three carriers ask this question and an
elision the cursor agrees with and the search highlight does not
is a caret sitting off its own match.
Trait Implementations§
Source§impl Clone for DisplayLine
impl Clone for DisplayLine
Source§fn clone(&self) -> DisplayLine
fn clone(&self) -> DisplayLine
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for DisplayLine
impl RefUnwindSafe for DisplayLine
impl Send for DisplayLine
impl Sync for DisplayLine
impl Unpin for DisplayLine
impl UnsafeUnpin for DisplayLine
impl UnwindSafe for DisplayLine
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