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

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

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.