Skip to content

Commit

Permalink
ViEditor::finish_change will store change to history
Browse files Browse the repository at this point in the history
  • Loading branch information
jackpot51 committed Dec 12, 2023
1 parent 3187e91 commit 6566350
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/edit/vi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,17 @@ fn finish_change<E: Edit>(
editor: &mut E,
commands: &mut cosmic_undo_2::Commands<Change>,
changed: &mut bool,
) {
) -> Option<Change> {
//TODO: join changes together
match editor.finish_change() {
Some(change) => {
if !change.items.is_empty() {
commands.push(change);
commands.push(change.clone());
*changed = true;
}
Some(change)
}
None => {}
None => None,
}
}

Expand Down Expand Up @@ -319,7 +320,7 @@ impl<'a> Edit for ViEditor<'a> {
}

fn finish_change(&mut self) -> Option<Change> {
self.editor.finish_change()
finish_change(&mut self.editor, &mut self.commands, &mut self.changed)
}

fn action(&mut self, font_system: &mut FontSystem, action: Action) {
Expand Down

0 comments on commit 6566350

Please sign in to comment.