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
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
impl UndoBehavior
Sourcepub fn create_undo_point_after(&self, previous: &UndoBehavior) -> bool
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§
Auto Trait Implementations§
impl Freeze for UndoBehavior
impl RefUnwindSafe for UndoBehavior
impl Send for UndoBehavior
impl Sync for UndoBehavior
impl Unpin for UndoBehavior
impl UnwindSafe for UndoBehavior
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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