pub struct TextAreaScrollInfo {
pub offset_px: f64,
pub source_line_rows: Vec<usize>,
}Expand description
Shared read-out of a TextArea’s scroll state for a sibling widget that
must mirror the editor’s viewport (e.g. a line-number gutter) but lives
outside its subtree and so cannot see the internal scroll bar. Published
through TextArea::with_scroll_watch.
The gutter’s core problem is that the editor scrolls in visual-row pixel
space while it numbers source lines; with soft-wrapping the two diverge, so
a bare offset is not enough. source_line_rows bridges that: it maps each
source line to the visual row its number should sit on.
Fields§
§offset_px: f64Vertical scroll offset in px from the top (0 = first row visible), the
same value TextArea::scroll_offset reports. Refreshed on every offset
change (wheel, drag, scroll-to-caret, relayout clamp).
source_line_rows: Vec<usize>For each source line (paragraph), the index of its first wrapped visual
row. source_line_rows[i] is where source line i’s number belongs;
continuation rows of a wrapped line fall between consecutive entries and
get no number. With no soft-wrapping this degenerates to rows[i] == i.
Refreshed only when the wrap cache rebuilds (not per scroll).
Trait Implementations§
Source§impl Clone for TextAreaScrollInfo
impl Clone for TextAreaScrollInfo
Source§impl Debug for TextAreaScrollInfo
impl Debug for TextAreaScrollInfo
Auto Trait Implementations§
impl Freeze for TextAreaScrollInfo
impl RefUnwindSafe for TextAreaScrollInfo
impl Send for TextAreaScrollInfo
impl Sync for TextAreaScrollInfo
impl Unpin for TextAreaScrollInfo
impl UnsafeUnpin for TextAreaScrollInfo
impl UnwindSafe for TextAreaScrollInfo
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,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§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>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§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>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§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.Source§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.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().