pub struct CursorView<'a, S: Wrap, T: Wrap> { /* private fields */ }Implementations§
Source§impl<'a, S: Wrap, T: Wrap> CursorView<'a, S, T>
impl<'a, S: Wrap, T: Wrap> CursorView<'a, S, T>
Source§impl<'a, S: WrapRef, T: WrapRef> CursorView<'a, S, T>
impl<'a, S: WrapRef, T: WrapRef> CursorView<'a, S, T>
pub fn new( text: T::WrapRef<'a, Text>, state: S::WrapRef<'a, CursorState>, ) -> Result<Self>
pub fn text(&self) -> &Text
pub fn state(&self) -> &CursorState
pub fn byte_index(&self) -> usize
pub fn line_index(&self) -> usize
pub fn line_number(&self) -> usize
pub fn column_number(&self) -> usize
pub fn display_column(&self) -> usize
pub fn grapheme(&self) -> RopeSlice<'_>
pub fn line(&self) -> RopeSlice<'_>
pub fn is_at_start(&self) -> bool
pub fn is_at_end(&self) -> bool
pub fn save(&self) -> CursorSnapshot
pub fn assert_invariants(&self) -> Result<()>
Source§impl<S: WrapMut, T: WrapRef> CursorView<'_, S, T>
impl<S: WrapMut, T: WrapRef> CursorView<'_, S, T>
pub fn move_to(&mut self, byte_index: usize)
pub fn move_left(&mut self, count: usize) -> bool
pub fn move_right(&mut self, count: usize) -> bool
pub fn move_up(&mut self, goal_column: GoalColumn, count: usize) -> bool
pub fn move_down(&mut self, goal_column: GoalColumn, count: usize) -> bool
pub fn move_to_prev_byte(&mut self, byte: u8, count: usize) -> bool
pub fn move_to_next_byte(&mut self, byte: u8, count: usize) -> bool
pub fn move_to_prev_blank(&mut self, count: usize) -> bool
pub fn move_to_next_blank(&mut self, count: usize) -> bool
pub fn move_to_start(&mut self)
pub fn move_to_end(&mut self)
pub fn move_to_bottom(&mut self)
pub fn move_to_line_start(&mut self)
pub fn move_to_line_non_blank_start(&mut self)
Sourcepub fn move_to_line_end(&mut self)
pub fn move_to_line_end(&mut self)
Move onto the line’s end: its '\n' (or "\r\n") grapheme. Always succeeds because
every line is terminated.
Sourcepub fn move_until_line_end(&mut self)
pub fn move_until_line_end(&mut self)
Move onto the last grapheme before the line’s end. Stays on the line end grapheme when the line is empty.
pub fn restore(&mut self, snapshot: &CursorSnapshot) -> bool
Source§impl<S: WrapMut, T: WrapMut> CursorView<'_, S, T>
impl<S: WrapMut, T: WrapMut> CursorView<'_, S, T>
pub fn insert_char(&mut self, char: char) -> Edit
Sourcepub fn insert(&mut self, text: &str) -> Edit
pub fn insert(&mut self, text: &str) -> Edit
Insert before the grapheme the cursor occupies. The cursor stays on its grapheme (i.e. ends up after the inserted text).
Sourcepub fn delete_before(&mut self) -> Option<Edit>
pub fn delete_before(&mut self) -> Option<Edit>
Delete the grapheme before the cursor. Behavior traditionally associated with the Backspace key.
Sourcepub fn delete_after(&mut self) -> Option<Edit>
pub fn delete_after(&mut self) -> Option<Edit>
Delete the grapheme the cursor occupies, unless it is the text’s final newline. Behavior traditionally associated with the Delete key.
Trait Implementations§
Source§impl<S: Wrap, T: Wrap> Drop for CursorView<'_, S, T>
impl<S: Wrap, T: Wrap> Drop for CursorView<'_, S, T>
Auto Trait Implementations§
impl<'a, S, T> !RefUnwindSafe for CursorView<'a, S, T>
impl<'a, S, T> !Send for CursorView<'a, S, T>
impl<'a, S, T> !Sync for CursorView<'a, S, T>
impl<'a, S, T> !UnwindSafe for CursorView<'a, S, T>
impl<'a, S, T> Freeze for CursorView<'a, S, T>where
<S as Wrap>::Wrap<'a, CursorState>: Freeze,
<T as Wrap>::Wrap<'a, Text>: Freeze,
Option<Box<dyn FnOnce(&mut CursorView<'a, S, T>) + 'a>>: Freeze,
impl<'a, S, T> Unpin for CursorView<'a, S, T>where
<S as Wrap>::Wrap<'a, CursorState>: Unpin,
<T as Wrap>::Wrap<'a, Text>: Unpin,
Option<Box<dyn FnOnce(&mut CursorView<'a, S, T>) + 'a>>: Unpin,
impl<'a, S, T> UnsafeUnpin for CursorView<'a, S, T>where
<S as Wrap>::Wrap<'a, CursorState>: UnsafeUnpin,
<T as Wrap>::Wrap<'a, Text>: UnsafeUnpin,
Option<Box<dyn FnOnce(&mut CursorView<'a, S, T>) + 'a>>: UnsafeUnpin,
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