pub struct SelectionSet { /* private fields */ }Expand description
The editor’s selections: a primary plus zero or more extras.
Invariants (enforced by normalize): extras sorted, deduped, none
equal to the primary’s head.
Implementations§
Source§impl SelectionSet
impl SelectionSet
pub fn primary(&self) -> Selection
pub fn extra_heads(&self) -> &[Selection]
pub fn count(&self) -> usize
Sourcepub fn collapse_primary(&mut self, at: usize)
pub fn collapse_primary(&mut self, at: usize)
Move head and anchor together (leaving visual mode, plain moves).
Sourcepub fn stretch_primary(&mut self, anchor: usize, head: usize)
pub fn stretch_primary(&mut self, anchor: usize, head: usize)
Enter/extend visual: the anchor stays, the head walks.
Sourcepub fn toggle_extra(&mut self)
pub fn toggle_extra(&mut self)
Q: drop the extra under the primary, else plant one there.
Sourcepub fn plant_extra(&mut self, at: usize)
pub fn plant_extra(&mut self, at: usize)
Plant an extra cursor (both ends at at). Never on the
primary’s head — Space c and match-planting skip that spot;
stacking on the primary is Q’s job (toggle_extra).
Sourcepub fn normalize(&mut self)
pub fn normalize(&mut self)
Sorted, deduped. An extra MAY sit on the primary’s head — Q
plants exactly there, then a motion walks them apart (0013).
Sourcepub fn collapse_extras(&mut self)
pub fn collapse_extras(&mut self)
Esc: extras die, primary stays.
Sourcepub fn set_extras(&mut self, heads: impl IntoIterator<Item = usize>)
pub fn set_extras(&mut self, heads: impl IntoIterator<Item = usize>)
Replace the extras wholesale — the motion cascade replants computed heads, and stacked-on-primary extras survive (they were planted by Q on purpose, 0013 §3).
Trait Implementations§
Source§impl Clone for SelectionSet
impl Clone for SelectionSet
Source§fn clone(&self) -> SelectionSet
fn clone(&self) -> SelectionSet
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more