pub struct Selection { /* private fields */ }
Expand description
Describes a region of a 2-dimensional area.
Used to track a text selection. There are four supported modes, each with its own constructor:
simple
, block
, semantic
, and lines
. The simple
mode precisely tracks which
cells are selected without any expansion. block
will select rectangular regions.
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
and block
mode do nothing special, simply track 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.
Implementations§
Source§impl Selection
impl Selection
pub fn simple(location: Point<usize>, side: Side) -> Selection
pub fn block(location: Point<usize>, side: Side) -> Selection
pub fn semantic(location: Point<usize>) -> Selection
pub fn lines(location: Point<usize>) -> Selection
pub fn update(&mut self, location: Point<usize>, side: Side)
pub fn rotate( self, num_lines: usize, num_cols: usize, scrolling_region: &Range<Line>, offset: isize, ) -> Option<Selection>
pub fn is_empty(&self) -> bool
Sourcepub fn to_range<T>(&self, term: &Term<T>) -> Option<SelectionRange>
pub fn to_range<T>(&self, term: &Term<T>) -> Option<SelectionRange>
Convert selection to grid coordinates.
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)