Executes a command and then pushes it to a history array.
(app: &mut Cursive, mut command: impl Command + 'static)
| 35 | |
| 36 | /// Executes a command and then pushes it to a history array. |
| 37 | fn execute(app: &mut Cursive, mut command: impl Command + 'static) { |
| 38 | if command.execute(app) { |
| 39 | app.with_user_data(|context: &mut AppContext| { |
| 40 | context.history.push(Box::new(command)); |
| 41 | }); |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | /// Pops the last command and executes an undo action. |
| 46 | fn undo(app: &mut Cursive) { |