history: Export undos, redos methods, and add clear method. (#527)
This commit is contained in:
parent
8b89b5ba7c
commit
5be03543dd
1 changed files with 16 additions and 0 deletions
|
|
@ -80,6 +80,22 @@ where
|
|||
self.undos.push(item);
|
||||
}
|
||||
|
||||
/// Get the undo stack.
|
||||
pub fn undos(&self) -> &Vec<I> {
|
||||
&self.undos
|
||||
}
|
||||
|
||||
/// Get the redo stack.
|
||||
pub fn redos(&self) -> &Vec<I> {
|
||||
&self.redos
|
||||
}
|
||||
|
||||
/// Clear the undo and redo stacks.
|
||||
pub fn clear(&mut self) {
|
||||
self.undos.clear();
|
||||
self.redos.clear();
|
||||
}
|
||||
|
||||
pub fn undo(&mut self) -> Option<Vec<I>> {
|
||||
if let Some(first_change) = self.undos.pop() {
|
||||
let mut changes = vec![first_change.clone()];
|
||||
|
|
|
|||
Loading…
Reference in a new issue