Skip to main content

RangeView

Struct RangeView 

Source
pub struct RangeView<'a, S: Wrap, T: Wrap> { /* private fields */ }

Implementations§

Source§

impl<'a, S: Wrap, T: Wrap> RangeView<'a, S, T>

Source

pub fn on_drop(self, f: impl FnOnce(&mut Self) + 'a) -> Self

Source§

impl<'a, S: WrapRef, T: WrapRef> RangeView<'a, S, T>

Source

pub fn new( text: T::WrapRef<'a, Text>, state: S::WrapRef<'a, RangeState>, ) -> Result<Self>

Source

pub fn text(&self) -> &Text

Source

pub fn state(&self) -> &RangeState

Source

pub fn byte_offsets(&self) -> (usize, usize)

Source

pub fn slice(&self) -> RopeSlice<'_>

Source

pub fn tail(&self) -> Cursor<'_>

Source

pub fn head(&self) -> Cursor<'_>

Source

pub fn start(&self) -> Cursor<'_>

Source

pub fn end(&self) -> Cursor<'_>

Source

pub fn goal_column(&self) -> Option<GoalColumn>

Source

pub fn byte_length(&self) -> usize

Source

pub fn grapheme_length(&self) -> usize

Source

pub fn is_forward(&self) -> bool

A collapsed range is considered forward.

Source

pub fn is_backward(&self) -> bool

Source

pub fn is_touching<S2, T2>(&self, other: &RangeView<'_, S2, T2>) -> bool
where S2: WrapRef, T2: WrapRef,

Source

pub fn is_overlapping<S2, T2>(&self, other: &RangeView<'_, S2, T2>) -> bool
where S2: WrapRef, T2: WrapRef,

Source

pub fn save(&self) -> RangeSnapshot

Source

pub fn assert_invariants(&self) -> Result<()>

Source§

impl<S: WrapMut, T: WrapRef> RangeView<'_, S, T>

Source

pub fn invalidate_goal_column(&mut self)

Should be called after performing any non-vertical movement.

Source

pub fn extend_to(&mut self, byte_index: usize)

Source

pub fn move_to(&mut self, byte_index: usize)

Source

pub fn extend_left(&mut self, count: usize)

Source

pub fn move_left(&mut self, count: usize)

Source

pub fn extend_right(&mut self, count: usize)

Source

pub fn move_right(&mut self, count: usize)

Source

pub fn extend_up(&mut self, count: usize)

Source

pub fn move_up(&mut self, count: usize)

Source

pub fn extend_down(&mut self, count: usize)

Source

pub fn move_down(&mut self, count: usize)

Source

pub fn extend_until_prev_byte(&mut self, byte: u8, count: usize)

Source

pub fn move_until_prev_byte(&mut self, byte: u8, count: usize)

Source

pub fn extend_onto_prev_byte(&mut self, byte: u8, count: usize)

Source

pub fn move_onto_prev_byte(&mut self, byte: u8, count: usize)

Source

pub fn extend_until_next_byte(&mut self, byte: u8, count: usize)

Source

pub fn move_until_next_byte(&mut self, byte: u8, count: usize)

Source

pub fn extend_onto_next_byte(&mut self, byte: u8, count: usize)

Source

pub fn move_onto_next_byte(&mut self, byte: u8, count: usize)

Source

pub fn extend_to_start(&mut self)

Source

pub fn move_to_start(&mut self)

Source

pub fn extend_to_end(&mut self)

Source

pub fn move_to_end(&mut self)

Source

pub fn extend_to_bottom(&mut self)

Source

pub fn move_to_bottom(&mut self)

Source

pub fn extend_to_line_start(&mut self)

Source

pub fn move_to_line_start(&mut self)

Source

pub fn extend_to_line_non_blank_start(&mut self)

Source

pub fn move_to_line_non_blank_start(&mut self)

Source

pub fn extend_until_line_end(&mut self)

Source

pub fn move_until_line_end(&mut self)

Source

pub fn extend_onto_line_end(&mut self)

Source

pub fn move_onto_line_end(&mut self)

Source

pub fn expand_to_full_lines(&mut self)

Source

pub fn flip(&mut self)

Source

pub fn flip_forward(&mut self)

Source

pub fn flip_backward(&mut self)

Source

pub fn collapse(&mut self)

Source

pub fn restore(&mut self, snapshot: &RangeSnapshot) -> bool

Source§

impl<S: WrapMut, T: WrapMut> RangeView<'_, S, T>

Source

pub fn expand_to_outer_node(&mut self) -> bool

Source

pub fn shrink_to_inner_node(&mut self) -> bool

Source

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.

Source

pub fn insert_char(&mut self, char: char) -> Edit

Source

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).

Source

pub fn delete_before(&mut self) -> Option<Edit>

Delete the grapheme before the range’s start.

Source

pub fn delete(&mut self) -> Edit

Delete the selected graphemes. Deleting through the end of the text re-inserts the invariant trailing newline.

Source

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§

Source§

impl<S: Wrap, T: Wrap> Drop for RangeView<'_, S, T>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl<R> TryFrom<(R, usize, usize)> for RangeView<'_, WBox, WBox>
where R: Into<Text>,

Source§

type Error = Error

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

fn try_from((text, tail, head): (R, usize, usize)) -> Result<Self>

Performs the conversion.

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>
where <S as Wrap>::Wrap<'a, RangeState>: Freeze, <T as Wrap>::Wrap<'a, Text>: Freeze, Option<Box<dyn FnOnce(&mut RangeView<'a, S, T>) + 'a>>: Freeze,

§

impl<'a, S, T> Unpin for RangeView<'a, S, T>
where <S as Wrap>::Wrap<'a, RangeState>: Unpin, <T as Wrap>::Wrap<'a, Text>: Unpin, Option<Box<dyn FnOnce(&mut RangeView<'a, S, T>) + 'a>>: Unpin,

§

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> 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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<I> FromItem<I> for I

Source§

fn from_item(item: I) -> I

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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, 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, <T as TryFrom<U>>::Error>

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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more