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.
A Text will keep itself in check with regards to its
Selections, that is, it will automatically remove and add the
MainCaret and ExtraCaret tags when the Selections
are altered. If it fails to do that, report it as a bug.
Implementations§
Source§impl Selections
impl Selections
Sourcepub fn new() -> Self
pub fn new() -> Self
Returns a new 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 iter(&self) -> impl Iterator<Item = (&Selection, bool)>
pub fn iter(&self) -> impl Iterator<Item = (&Selection, bool)>
Iterates over all Selections in order
Sourcepub fn main_index(&self) -> usize
pub fn main_index(&self) -> usize
The index of the main Selection
Trait Implementations§
Source§impl Clone for Selections
impl Clone for Selections
Source§fn clone(&self) -> Selections
fn clone(&self) -> Selections
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more