Skip to main content

SelectionView

Struct SelectionView 

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

Implementations§

Source§

impl<S: Wrap, T: Wrap> SelectionView<'_, S, T>

Source

pub fn on_drop(self, f: fn(&mut Self)) -> Self

Source§

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

Source

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

Source

pub fn text(&self) -> &Text

Source

pub fn get(&self, index: usize) -> Option<Range<'_>>

Source

pub fn get_primary(&self) -> Range<'_>

Source

pub fn for_each(&self, f: impl FnMut(usize, Range<'_>))

Source

pub fn contents(&self) -> impl Iterator<Item = RopeSlice<'_>>

Source

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

Source§

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

Source

pub fn for_each_move(&mut self, f: impl FnMut(RangeMove<'_>))

Source

pub fn merge_overlapping(&mut self)

Source

pub fn keep_primary(&mut self)

Source

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

Source

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

Source

pub fn select_regex(&mut self, regex: &Regex) -> bool

Select every regex match within each range. Empty (zero-width) matches become one-grapheme selections at the match position, as in Kakoune. Returns false and leaves the selection unmodified when nothing matched.

Source

pub fn select_all(&mut self)

Source

pub fn split_into_lines(&mut self)

Source§

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

Source

pub fn for_each_edit(&mut self, f: impl FnMut(RangeEdit<'_>))

Source

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

Source

pub fn insert(&mut self, text: &str) -> Edit

Source

pub fn paste(&mut self, values: &[String], paste_mode: PasteMode) -> Edit

Source

pub fn paste_all(&mut self, values: &[String], paste_mode: PasteMode) -> Edit

Paste every value at each range, then select each value separately (like Kakoune).

Source

pub fn replace_each(&mut self, byte: u8) -> Edit

Source

pub fn delete_before(&mut self) -> Edit

Source

pub fn delete(&mut self) -> Edit

Source

pub fn delete_after(&mut self) -> Edit

Methods from Deref<Target = SelectionState>§

Source

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

Whether every range in other lies within the range at the same index in self.

Source

pub fn save(&self, text: &Text) -> SelectionSnapshot

Trait Implementations§

Source§

impl<S: WrapRef, T: Wrap> Deref for SelectionView<'_, S, T>

Source§

type Target = SelectionState

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<S: Wrap, T: Wrap> Drop for SelectionView<'_, 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

Auto Trait Implementations§

§

impl<'a, S, T> Freeze for SelectionView<'a, S, T>
where <S as Wrap>::Wrap<'a, SelectionState>: Freeze, <T as Wrap>::Wrap<'a, Text>: Freeze, Option<fn(&mut SelectionView<'a, S, T>)>: Freeze,

§

impl<'a, S, T> RefUnwindSafe for SelectionView<'a, S, T>
where <S as Wrap>::Wrap<'a, SelectionState>: RefUnwindSafe, <T as Wrap>::Wrap<'a, Text>: RefUnwindSafe, Option<fn(&mut SelectionView<'a, S, T>)>: RefUnwindSafe,

§

impl<'a, S, T> Send for SelectionView<'a, S, T>
where <S as Wrap>::Wrap<'a, SelectionState>: Send, <T as Wrap>::Wrap<'a, Text>: Send, Option<fn(&mut SelectionView<'a, S, T>)>: Send,

§

impl<'a, S, T> Sync for SelectionView<'a, S, T>
where <S as Wrap>::Wrap<'a, SelectionState>: Sync, <T as Wrap>::Wrap<'a, Text>: Sync, Option<fn(&mut SelectionView<'a, S, T>)>: Sync,

§

impl<'a, S, T> Unpin for SelectionView<'a, S, T>
where <S as Wrap>::Wrap<'a, SelectionState>: Unpin, <T as Wrap>::Wrap<'a, Text>: Unpin, Option<fn(&mut SelectionView<'a, S, T>)>: Unpin,

§

impl<'a, S, T> UnsafeUnpin for SelectionView<'a, S, T>
where <S as Wrap>::Wrap<'a, SelectionState>: UnsafeUnpin, <T as Wrap>::Wrap<'a, Text>: UnsafeUnpin, Option<fn(&mut SelectionView<'a, S, T>)>: UnsafeUnpin,

§

impl<'a, S, T> UnwindSafe for SelectionView<'a, S, T>
where <S as Wrap>::Wrap<'a, SelectionState>: UnwindSafe, <T as Wrap>::Wrap<'a, Text>: UnwindSafe, Option<fn(&mut SelectionView<'a, S, T>)>: UnwindSafe,

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

§

fn simd_from(_simd: S, value: T) -> T

§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

§

fn simd_into(self, simd: S) -> T

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

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