pub enum Selection {
Simple {
region: Range<Anchor>,
},
Semantic {
region: Range<Point<isize>>,
},
Lines {
region: Range<Point<isize>>,
initial_line: isize,
},
}
Expand description
Describes a region of a 2-dimensional area
Used to track a text selection. There are three supported modes, each with its own constructor:
simple
, semantic
, and lines
. The simple
mode precisely tracks which cells are
selected without any expansion. semantic
mode expands the initial selection to the nearest
semantic escape char in either direction. lines
will always select entire lines.
Calls to [update
] operate different based on the selection kind. The simple
mode does
nothing special, simply tracks points and sides. semantic
will continue to expand out to
semantic boundaries as the selection point changes. Similarly, lines
will always expand the
new point to encompass entire lines.
Variants§
Implementations§
Source§impl Selection
impl Selection
pub fn simple(location: Point<usize>, side: Side) -> Selection
pub fn rotate(&mut self, offset: isize)
pub fn semantic(point: Point<usize>) -> Selection
pub fn lines(point: Point<usize>) -> Selection
pub fn update(&mut self, location: Point<usize>, side: Side)
pub fn to_span<G>(&self, grid: &G, alt_screen: bool) -> Option<Span>where
G: Search + Dimensions,
pub fn is_empty(&self) -> bool
Trait Implementations§
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 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