#[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
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.interval: IntervalStart offset to end offset in the buffer that this visual line covers.
Note that this is obviously not including phantom text.
line_count: usizeThe total number of lines in this buffer line. Always at least 1.
rvline: RVLine§vline: LThe actual visual line this is for.
For relative visual line iteration, this is empty.
Implementations§
Source§impl<L: Debug> VLineInfo<L>
impl<L: Debug> VLineInfo<L>
Sourcepub fn new<I: Into<Interval>>(
iv: I,
rvline: RVLine,
line_count: usize,
vline: L,
) -> Self
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.
pub fn to_blank(&self) -> VLineInfo<()>
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Check whether the interval is empty.
Note that there could still be phantom text on this line.
Sourcepub fn is_empty_phantom(&self) -> bool
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)
pub fn is_first(&self) -> bool
Sourcepub fn is_last(&self, text_prov: &impl TextLayoutProvider) -> bool
pub fn is_last(&self, text_prov: &impl TextLayoutProvider) -> bool
Is this the last visual line for the relevant buffer line?
Sourcepub fn first_col(&self, text_prov: &impl TextLayoutProvider) -> usize
pub fn first_col(&self, text_prov: &impl TextLayoutProvider) -> usize
Get the first column of the overall line of the visual line
Sourcepub fn last_col(
&self,
text_prov: &impl TextLayoutProvider,
caret: bool,
) -> usize
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();|"pub fn line_end_offset( &self, text_prov: &impl TextLayoutProvider, caret: bool, ) -> usize
Sourcepub fn first_non_blank_character(
&self,
text_prov: &impl TextLayoutProvider,
) -> usize
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§
impl<L: Copy> Copy for VLineInfo<L>
impl<L: Eq> Eq for VLineInfo<L>
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> 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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