pub struct EventMgmt { /* private fields */ }
Expand description
For managing events for purposes of undo and redo
Implementations§
source§impl EventMgmt
impl EventMgmt
sourcepub fn register(&mut self, ev: Event)
pub fn register(&mut self, ev: Event)
Register that an event has occurred with the event manager
sourcepub fn commit(&mut self)
pub fn commit(&mut self)
This will commit the current patch to the undo stack, ready to be undone. You can call this after every space character, for example, which would make it so that every undo action would remove the previous word the user typed.
sourcepub fn undo(&mut self) -> Option<Vec<Event>>
pub fn undo(&mut self) -> Option<Vec<Event>>
Provide a list of actions to perform in order of when they should be applied for purposes of undoing (you’ll need to reverse the events themselves manually)
sourcepub fn redo(&mut self) -> Option<Vec<Event>>
pub fn redo(&mut self) -> Option<Vec<Event>>
Provide a list of events to execute in order of when they should be applied for purposes of redoing
sourcepub fn is_undo_empty(&self) -> bool
pub fn is_undo_empty(&self) -> bool
Returns true if the undo stack is empty, meaning no patches have been applied
sourcepub fn is_redo_empty(&self) -> bool
pub fn is_redo_empty(&self) -> bool
Returns true if the redo stack is empty, meaning no patches have been undone
sourcepub fn is_patch_empty(&self) -> bool
pub fn is_patch_empty(&self) -> bool
Returns true if the current patch is empty, meaning no edits have been done since the last commit