pub struct ScreenLines {
pub lines: Rc<Vec<RVLine>>,
pub info: Rc<HashMap<RVLine, LineInfo>>,
pub diff_sections: Option<Rc<Vec<DiffSection>>>,
pub base: RwSignal<ScreenLinesBase>,
}
Fields§
§lines: Rc<Vec<RVLine>>
§info: Rc<HashMap<RVLine, LineInfo>>
Guaranteed to have an entry for each VLine
in lines
You should likely use accessor functions rather than this directly.
diff_sections: Option<Rc<Vec<DiffSection>>>
§base: RwSignal<ScreenLinesBase>
The base y position that all the y positions inside info
are relative to.
This exists so that if a text layout is created outside of the view, we don’t have to
completely recompute the screen lines (or do somewhat intricate things to update them)
we simply have to update the base_y
.
Implementations§
Source§impl ScreenLines
impl ScreenLines
pub fn new(cx: Scope, viewport: Rect) -> ScreenLines
pub fn is_empty(&self) -> bool
pub fn clear(&mut self, viewport: Rect)
pub fn vline_info(&self, rvline: RVLine) -> Option<VLineInfo<()>>
pub fn rvline_range(&self) -> Option<(RVLine, RVLine)>
Sourcepub fn iter_line_info(&self) -> impl Iterator<Item = LineInfo> + '_
pub fn iter_line_info(&self) -> impl Iterator<Item = LineInfo> + '_
Iterate over the line info, copying them with the full y positions.
Sourcepub fn iter_line_info_r(
&self,
r: RangeInclusive<RVLine>,
) -> impl Iterator<Item = LineInfo> + '_
pub fn iter_line_info_r( &self, r: RangeInclusive<RVLine>, ) -> impl Iterator<Item = LineInfo> + '_
Iterate over the line info within the range, copying them with the full y positions.
If the values are out of range, it is clamped to the valid lines within.
pub fn iter_vline_info(&self) -> impl Iterator<Item = VLineInfo<()>> + '_
pub fn iter_vline_info_r( &self, r: RangeInclusive<RVLine>, ) -> impl Iterator<Item = VLineInfo<()>> + '_
Sourcepub fn iter_lines(&self) -> impl Iterator<Item = usize> + '_
pub fn iter_lines(&self) -> impl Iterator<Item = usize> + '_
Iter the real lines underlying the visual lines on the screen
Sourcepub fn iter_lines_y(&self) -> impl Iterator<Item = (usize, f64)> + '_
pub fn iter_lines_y(&self) -> impl Iterator<Item = (usize, f64)> + '_
Iterate over the real lines underlying the visual lines on the screen with the y position
of their layout.
(line, y)
Sourcepub fn info_for_line(&self, line: usize) -> Option<LineInfo>
pub fn info_for_line(&self, line: usize) -> Option<LineInfo>
Get the earliest line info for a given line.
Sourcepub fn first_rvline_for_line(&self, line: usize) -> Option<RVLine>
pub fn first_rvline_for_line(&self, line: usize) -> Option<RVLine>
Get the earliest rvline for the given line
Sourcepub fn last_rvline_for_line(&self, line: usize) -> Option<RVLine>
pub fn last_rvline_for_line(&self, line: usize) -> Option<RVLine>
Get the latest rvline for the given line
Sourcepub fn on_created_layout(&self, ed: &Editor, line: usize) -> bool
pub fn on_created_layout(&self, ed: &Editor, line: usize) -> bool
Ran on LayoutEvent::CreatedLayout
to update ScreenLinesBase
&
the viewport if necessary.
Returns true
if ScreenLines
needs to be completely updated in response
Trait Implementations§
Source§impl Clone for ScreenLines
impl Clone for ScreenLines
Source§fn clone(&self) -> ScreenLines
fn clone(&self) -> ScreenLines
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl PartialEq for ScreenLines
impl PartialEq for ScreenLines
impl StructuralPartialEq for ScreenLines
Auto Trait Implementations§
impl Freeze for ScreenLines
impl RefUnwindSafe for ScreenLines
impl !Send for ScreenLines
impl !Sync for ScreenLines
impl Unpin for ScreenLines
impl UnwindSafe for ScreenLines
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,
§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> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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