Enum reedline::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
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