(&mut self, app: &mut Cursive)
| 10 | |
| 11 | impl Command for CutCommand { |
| 12 | fn execute(&mut self, app: &mut Cursive) -> bool { |
| 13 | let mut editor = app.find_name::<EditView>("Editor").unwrap(); |
| 14 | |
| 15 | app.with_user_data(|context: &mut AppContext| { |
| 16 | self.backup = editor.get_content().to_string(); |
| 17 | context.clipboard = self.backup.clone(); |
| 18 | editor.set_content("".to_string()); |
| 19 | }); |
| 20 | |
| 21 | true |
| 22 | } |
| 23 | |
| 24 | fn undo(&mut self, app: &mut Cursive) { |
| 25 | let mut editor = app.find_name::<EditView>("Editor").unwrap(); |