pub struct Selection {
pub start: (usize, usize),
pub end: (usize, usize),
pub mode: SelectionMode,
pub scroll_offset: usize,
}Expand description
Selection state for text selection
Fields§
§start: (usize, usize)Start position (col, row) in viewport-relative coordinates at scroll_offset
end: (usize, usize)End position (col, row) in viewport-relative coordinates at scroll_offset
mode: SelectionModeSelection mode
scroll_offset: usizeScroll offset at the time the selection was captured.
Row coordinates are viewport-relative (0 = top of the visible screen) when
scroll_offset was the active viewport offset. The renderer adjusts the
rows by (self.scroll_offset as isize - current_scroll_offset as isize) so
the highlight tracks the content as the user scrolls.
Implementations§
Source§impl Selection
impl Selection
Sourcepub fn new(
start: (usize, usize),
end: (usize, usize),
mode: SelectionMode,
scroll_offset: usize,
) -> Self
pub fn new( start: (usize, usize), end: (usize, usize), mode: SelectionMode, scroll_offset: usize, ) -> Self
Create a new selection.
scroll_offset must be the current viewport scroll offset so the
renderer can compensate when the user scrolls after the selection.
Sourcepub fn viewport_adjusted(&self, current_scroll_offset: usize) -> Self
pub fn viewport_adjusted(&self, current_scroll_offset: usize) -> Self
Return a copy of this selection with rows adjusted to current_scroll_offset.
Rows that shift above the top of the viewport become usize::MAX so that
is_cell_selected never matches them. Rows shifted below the viewport are
left as-is (they exceed the row count and are also never matched).
Trait Implementations§
impl Copy for Selection
impl StructuralPartialEq for Selection
Auto Trait Implementations§
impl Freeze for Selection
impl RefUnwindSafe for Selection
impl Send for Selection
impl Sync for Selection
impl Unpin for Selection
impl UnsafeUnpin for Selection
impl UnwindSafe for Selection
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>. Box<dyn Any> can
then be further downcast into Box<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>. Rc<Any> 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> DowncastSync for T
impl<T> DowncastSync for T
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
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