pub struct RangeView<'a, S: Wrap, T: Wrap> { /* private fields */ }Implementations§
Source§impl<'a, S: WrapRef, T: WrapRef> RangeView<'a, S, T>
impl<'a, S: WrapRef, T: WrapRef> RangeView<'a, S, T>
pub fn new( text: T::WrapRef<'a, Text>, state: S::WrapRef<'a, RangeState>, ) -> Result<Self>
pub fn text(&self) -> &Text
pub fn state(&self) -> &RangeState
pub fn byte_offsets(&self) -> (usize, usize)
pub fn slice(&self) -> RopeSlice<'_>
pub fn tail(&self) -> Cursor<'_>
pub fn head(&self) -> Cursor<'_>
pub fn start(&self) -> Cursor<'_>
pub fn end(&self) -> Cursor<'_>
pub fn goal_column(&self) -> Option<GoalColumn>
pub fn byte_length(&self) -> usize
pub fn grapheme_length(&self) -> usize
Sourcepub fn is_forward(&self) -> bool
pub fn is_forward(&self) -> bool
A collapsed range is considered forward.
pub fn is_backward(&self) -> bool
pub fn is_touching<S2, T2>(&self, other: &RangeView<'_, S2, T2>) -> boolwhere
S2: WrapRef,
T2: WrapRef,
pub fn is_overlapping<S2, T2>(&self, other: &RangeView<'_, S2, T2>) -> boolwhere
S2: WrapRef,
T2: WrapRef,
pub fn save(&self) -> RangeSnapshot
pub fn assert_invariants(&self) -> Result<()>
Source§impl<S: WrapMut, T: WrapRef> RangeView<'_, S, T>
impl<S: WrapMut, T: WrapRef> RangeView<'_, S, T>
Sourcepub fn invalidate_goal_column(&mut self)
pub fn invalidate_goal_column(&mut self)
Should be called after performing any non-vertical movement.
pub fn extend_to(&mut self, byte_index: usize)
pub fn move_to(&mut self, byte_index: usize)
pub fn extend_left(&mut self, count: usize)
pub fn move_left(&mut self, count: usize)
pub fn extend_right(&mut self, count: usize)
pub fn move_right(&mut self, count: usize)
pub fn extend_up(&mut self, count: usize)
pub fn move_up(&mut self, count: usize)
pub fn extend_down(&mut self, count: usize)
pub fn move_down(&mut self, count: usize)
pub fn extend_until_prev_byte(&mut self, byte: u8, count: usize)
pub fn move_until_prev_byte(&mut self, byte: u8, count: usize)
pub fn extend_onto_prev_byte(&mut self, byte: u8, count: usize)
pub fn move_onto_prev_byte(&mut self, byte: u8, count: usize)
pub fn extend_until_next_byte(&mut self, byte: u8, count: usize)
pub fn move_until_next_byte(&mut self, byte: u8, count: usize)
pub fn extend_onto_next_byte(&mut self, byte: u8, count: usize)
pub fn move_onto_next_byte(&mut self, byte: u8, count: usize)
pub fn extend_to_start(&mut self)
pub fn move_to_start(&mut self)
pub fn extend_to_end(&mut self)
pub fn move_to_end(&mut self)
pub fn extend_to_bottom(&mut self)
pub fn move_to_bottom(&mut self)
pub fn extend_to_line_start(&mut self)
pub fn move_to_line_start(&mut self)
pub fn extend_to_line_non_blank_start(&mut self)
pub fn move_to_line_non_blank_start(&mut self)
pub fn extend_until_line_end(&mut self)
pub fn move_until_line_end(&mut self)
pub fn extend_onto_line_end(&mut self)
pub fn move_onto_line_end(&mut self)
pub fn expand_to_full_lines(&mut self)
pub fn flip(&mut self)
pub fn flip_forward(&mut self)
pub fn flip_backward(&mut self)
pub fn collapse(&mut self)
pub fn restore(&mut self, snapshot: &RangeSnapshot) -> bool
Source§impl<S: WrapMut, T: WrapMut> RangeView<'_, S, T>
impl<S: WrapMut, T: WrapMut> RangeView<'_, S, T>
pub fn expand_to_outer_node(&mut self) -> bool
pub fn shrink_to_inner_node(&mut self) -> bool
Sourcepub fn prepare_append(&mut self) -> Option<Edit>
pub fn prepare_append(&mut self) -> Option<Edit>
Reshape for appending (Kakoune’s a): collapse to the head, then move onto the following
grapheme so insertion lands after the original head. On the text’s last grapheme there is
no following grapheme, so a newline is appended first (as Kakoune does) and the cursor
lands on it.
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 range’s first grapheme. Both endpoints stay on their graphemes (i.e. end 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 range’s start.
Sourcepub fn delete(&mut self) -> Edit
pub fn delete(&mut self) -> Edit
Delete the selected graphemes. Deleting through the end of the text re-inserts the invariant trailing newline.
Sourcepub fn delete_after(&mut self) -> Option<Edit>
pub fn delete_after(&mut self) -> Option<Edit>
Delete the grapheme under the range’s end cursor, unless it is the text’s final newline.
Trait Implementations§
Auto Trait Implementations§
impl<'a, S, T> !RefUnwindSafe for RangeView<'a, S, T>
impl<'a, S, T> !Send for RangeView<'a, S, T>
impl<'a, S, T> !Sync for RangeView<'a, S, T>
impl<'a, S, T> !UnwindSafe for RangeView<'a, S, T>
impl<'a, S, T> Freeze for RangeView<'a, S, T>
impl<'a, S, T> Unpin for RangeView<'a, S, T>
impl<'a, S, T> UnsafeUnpin for RangeView<'a, S, T>where
<S as Wrap>::Wrap<'a, RangeState>: UnsafeUnpin,
<T as Wrap>::Wrap<'a, Text>: UnsafeUnpin,
Option<Box<dyn FnOnce(&mut RangeView<'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