Skip to main content

MultiCursor

Struct MultiCursor 

Source
pub struct MultiCursor { /* private fields */ }
Expand description

Multi-cursor engine managing synchronized cursors across the document.

Implementations§

Source§

impl MultiCursor

Source

pub fn new() -> Self

Initializes multi-cursor engine with a single cursor at (0, 0).

Source

pub fn single(pos: Position) -> Self

Initializes with a single cursor at specified position.

Source

pub fn from_selections(selections: Vec<Selection>) -> Self

Constructs a MultiCursor engine directly from a collection of selections.

Source

pub fn primary(&self) -> &Selection

Returns the primary active selection.

Source

pub fn all(&self) -> &[Selection]

Returns all active selections.

Source

pub fn all_mut(&mut self) -> &mut [Selection]

Returns mutable slice of all selections.

Source

pub fn clear(&mut self)

Clears all selections.

Source

pub fn set_single(&mut self, pos: Position)

Clears secondary cursors and sets single active caret.

Source

pub fn add_selection(&mut self, sel: Selection)

Appends a new cursor or selection range, automatically normalizing and merging.

Source

pub fn add_cursor(&mut self, pos: Position)

Appends a new single-point cursor caret at pos.

Source

pub fn count(&self) -> usize

Returns the number of active selections/cursors.

Source

pub fn add_column_cursors( &mut self, start_line: usize, end_line: usize, col: usize, )

Adds rectangular column block cursors between start_line and end_line at column col.

Source

pub fn normalize(&mut self)

Normalizes selections: sorts them in document order and merges any overlapping carets.

Source

pub fn selections_descending(&self) -> Vec<Selection>

Returns all active selections sorted in descending document order (bottom-to-top, right-to-left).

Trait Implementations§

Source§

impl Clone for MultiCursor

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MultiCursor

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MultiCursor

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for MultiCursor

Source§

impl PartialEq for MultiCursor

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for MultiCursor

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.