Skip to main content

DisplayLine

Struct DisplayLine 

Source
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: u32

Logical (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: u32

Display 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

Source

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.

Source

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

Source§

fn clone(&self) -> DisplayLine

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DisplayLine

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &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
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> IntoMaybeUndefined<T> for T

§

fn into_maybe_undefined(self) -> MaybeUndefined<T>

Converts this value into a three-state builder argument.
§

impl<T> IntoOption<T> for T

§

fn into_option(self) -> Option<T>

Converts this value into an optional builder argument.
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Pointee for T

§

type Pointer = u32

§

fn debug( pointer: <T as Pointee>::Pointer, f: &mut Formatter<'_>, ) -> Result<(), Error>

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more