UndoBehavior

Enum UndoBehavior 

Source
pub enum UndoBehavior {
    InsertCharacter(char),
    Backspace(Option<char>),
    Delete(Option<char>),
    MoveCursor,
    HistoryNavigation,
    CreateUndoPoint,
    UndoRedo,
}
Expand description

Every line change should come with an UndoBehavior tag, which can be used to calculate how the change should be reflected on the undo stack

Variants§

§

InsertCharacter(char)

Character insertion, tracking the character inserted

§

Backspace(Option<char>)

Backspace command, tracking the deleted character (left of cursor) Warning: this does not track the whole grapheme, just the character

§

Delete(Option<char>)

Delete command, tracking the deleted character (right of cursor) Warning: this does not track the whole grapheme, just the character

§

MoveCursor

Move the cursor position

§

HistoryNavigation

Navigated the history using up or down arrows

§

CreateUndoPoint

Catch-all for actions that should always form a unique undo point and never be grouped with later edits

§

UndoRedo

Undo/Redo actions shouldn’t be reflected on the edit stack

Implementations§

Source§

impl UndoBehavior

Source

pub fn create_undo_point_after(&self, previous: &UndoBehavior) -> bool

Return if the current operation should start a new undo set, or be combined with the previous operation

Trait Implementations§

Source§

impl Debug for UndoBehavior

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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.