Pops the last command and executes an undo action.
(app: &mut Cursive)
| 44 | |
| 45 | /// Pops the last command and executes an undo action. |
| 46 | fn undo(app: &mut Cursive) { |
| 47 | let mut context = app.take_user_data::<AppContext>().unwrap(); |
| 48 | if let Some(mut command) = context.history.pop() { |
| 49 | command.undo(app) |
| 50 | } |
| 51 | app.set_user_data(context); |
| 52 | } |