pub struct Cursor {
pub mode: CursorMode,
pub horiz: Option<ColPosition>,
pub motion_mode: Option<MotionMode>,
pub history_selections: Vec<Selection>,
pub affinity: CursorAffinity,
}
Fields§
§mode: CursorMode
§horiz: Option<ColPosition>
§motion_mode: Option<MotionMode>
§history_selections: Vec<Selection>
§affinity: CursorAffinity
Implementations§
Source§impl Cursor
impl Cursor
pub fn new( mode: CursorMode, horiz: Option<ColPosition>, motion_mode: Option<MotionMode>, ) -> Self
pub fn origin(modal: bool) -> Self
pub fn offset(&self) -> usize
pub fn start_offset(&self) -> usize
pub fn regions_iter(&self) -> impl ExactSizeIterator<Item = (usize, usize)> + '_
pub fn is_normal(&self) -> bool
pub fn is_insert(&self) -> bool
pub fn is_visual(&self) -> bool
pub fn get_mode(&self) -> Mode
pub fn set_mode(&mut self, mode: CursorMode)
pub fn set_insert(&mut self, selection: Selection)
pub fn update_selection(&mut self, buffer: &Buffer, selection: Selection)
pub fn edit_selection(&self, text: &impl RopeText) -> Selection
pub fn apply_delta(&mut self, delta: &RopeDelta)
pub fn yank(&self, text: &impl RopeText) -> RegisterData
Sourcepub fn get_selection(&self) -> Option<(usize, usize)>
pub fn get_selection(&self) -> Option<(usize, usize)>
Return the current selection start and end position for a Single cursor selection
pub fn get_line_col_char( &self, buffer: &Buffer, ) -> Option<(usize, usize, usize)>
pub fn get_selection_count(&self) -> usize
pub fn set_offset(&mut self, offset: usize, modify: bool, new_cursor: bool)
pub fn add_region( &mut self, start: usize, end: usize, modify: bool, new_cursor: bool, )
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Cursor
impl<'de> Deserialize<'de> for Cursor
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Cursor
Auto Trait Implementations§
impl Freeze for Cursor
impl RefUnwindSafe for Cursor
impl Send for Cursor
impl Sync for Cursor
impl Unpin for Cursor
impl UnwindSafe for Cursor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more