VLineInfo

Struct VLineInfo 

Source
#[non_exhaustive]
pub struct VLineInfo<L = VLine> { pub interval: Interval, pub line_count: usize, pub rvline: RVLine, pub vline: L, }
Expand description

Information about the visual line and how it relates to the underlying buffer line.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§interval: Interval

Start offset to end offset in the buffer that this visual line covers.

Note that this is obviously not including phantom text.

§line_count: usize

The total number of lines in this buffer line. Always at least 1.

§rvline: RVLine§vline: L

The actual visual line this is for.

For relative visual line iteration, this is empty.

Implementations§

Source§

impl<L: Debug> VLineInfo<L>

Source

pub fn new<I: Into<Interval>>( iv: I, rvline: RVLine, line_count: usize, vline: L, ) -> Self

Create a new instance of VLineInfo

This should rarely be used directly.

Source

pub fn to_blank(&self) -> VLineInfo<()>

Source

pub fn is_empty(&self) -> bool

Check whether the interval is empty.

Note that there could still be phantom text on this line.

Source

pub fn is_empty_phantom(&self) -> bool

Check whether the interval is empty and we’re not on the first line, thus likely being phantom text (or possibly poor wrapping)

Source

pub fn is_first(&self) -> bool

Source

pub fn is_last(&self, text_prov: &impl TextLayoutProvider) -> bool

Is this the last visual line for the relevant buffer line?

Source

pub fn first_col(&self, text_prov: &impl TextLayoutProvider) -> usize

Get the first column of the overall line of the visual line

Source

pub fn last_col( &self, text_prov: &impl TextLayoutProvider, caret: bool, ) -> usize

Get the last column in the overall line of this visual line

The caret decides whether it is after the last character, or before it.

// line content = "conf = Config::default();\n"
// wrapped breakup = ["conf = ", "Config::default();\n"]

// when vline_info is for "conf = "
assert_eq!(vline_info.last_col(text_prov, false), 6) // "conf =| "
assert_eq!(vline_info.last_col(text_prov, true), 7) // "conf = |"
// when vline_info is for "Config::default();\n"
// Notice that the column is in the overall line, not the wrapped line.
assert_eq!(vline_info.last_col(text_prov, false), 24) // "Config::default()|;"
assert_eq!(vline_info.last_col(text_prov, true), 25) // "Config::default();|"
Source

pub fn line_end_offset( &self, text_prov: &impl TextLayoutProvider, caret: bool, ) -> usize

Source

pub fn first_non_blank_character( &self, text_prov: &impl TextLayoutProvider, ) -> usize

Returns the offset of the first non-blank character in the line.

Trait Implementations§

Source§

impl<L: Clone> Clone for VLineInfo<L>

Source§

fn clone(&self) -> VLineInfo<L>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<L: Debug> Debug for VLineInfo<L>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<L: PartialEq> PartialEq for VLineInfo<L>

Source§

fn eq(&self, other: &VLineInfo<L>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<L: Copy> Copy for VLineInfo<L>

Source§

impl<L: Eq> Eq for VLineInfo<L>

Source§

impl<L> StructuralPartialEq for VLineInfo<L>

Auto Trait Implementations§

§

impl<L> Freeze for VLineInfo<L>
where L: Freeze,

§

impl<L> RefUnwindSafe for VLineInfo<L>
where L: RefUnwindSafe,

§

impl<L> Send for VLineInfo<L>
where L: Send,

§

impl<L> Sync for VLineInfo<L>
where L: Sync,

§

impl<L> Unpin for VLineInfo<L>
where L: Unpin,

§

impl<L> UnwindSafe for VLineInfo<L>
where L: UnwindSafe,

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

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

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
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.
Source§

impl<T> WithSubscriber for T

Source§

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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

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

Source§

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

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,