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.