pub struct Selection {
pub anchor: usize,
pub head: usize,
pub goal_column: Option<usize>,
}Expand description
A selection between anchor (fixed end) and head (the caret), in char offsets.
An empty selection is a plain cursor.
Fields§
§anchor: usize§head: usize§goal_column: Option<usize>Column the caret tries to return to when moving vertically through shorter lines.
Implementations§
Source§impl Selection
impl Selection
pub const fn new(anchor: usize, head: usize) -> Self
pub const fn cursor(pos: usize) -> Self
pub fn start(&self) -> usize
pub fn end(&self) -> usize
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn is_backward(&self) -> bool
pub fn is_backward(&self) -> bool
True when the caret sits before the anchor (selection made right to left).
Trait Implementations§
impl Copy for Selection
impl Eq for Selection
impl StructuralPartialEq for Selection
Auto Trait Implementations§
impl Forget for Selection
impl Freeze for Selection
impl Move 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
Mutably borrows from an owned value. Read more