pub struct Selections { /* private fields */ }Expand description
The list of Selections in a Text
This list can contain any number of Selections, and they
should be usable in whatever order the end user may want, without
breaking from, for example, modifications that should move cursors
backwards or ahead. If that is not the case, report it as a bug.
they are primarily meant to be interacted with from the
Handle, with its edit_ methods meant to efficiently
handle a large number of Selections in an efficient manner,
although you can interact with them separately.
Implementations§
Source§impl Selections
impl Selections
Sourcepub fn rotate_main(&mut self, amount: i32)
pub fn rotate_main(&mut self, amount: i32)
Rotates the main Selection by an amount
Sourcepub fn reset(&mut self)
pub fn reset(&mut self)
Removes all Selections and adds a default Selection as
main
Sourcepub fn remove_extras(&mut self)
pub fn remove_extras(&mut self)
Removes all but the main Selection
Sourcepub fn main(&self) -> &Selection
pub fn main(&self) -> &Selection
Gets the main Selection
§Panics
This method will panic if there are no Selections. If you
want a non-panicking method, see Selections::get_main.
Sourcepub fn get_main(&self) -> Option<&Selection>
pub fn get_main(&self) -> Option<&Selection>
Gets the main Selection, if there is one
If you want a method that doesn’t return an Option (for
convenience), see Selections::main.
Sourcepub fn iter_within(
&self,
range: impl TextRange,
) -> impl Iterator<Item = (usize, &Selection, bool)>
pub fn iter_within( &self, range: impl TextRange, ) -> impl Iterator<Item = (usize, &Selection, bool)>
Sourcepub fn main_index(&self) -> usize
pub fn main_index(&self) -> usize
The index of the main Selection