aboutsummaryrefslogtreecommitdiff
path: root/helix-view
diff options
context:
space:
mode:
Diffstat (limited to 'helix-view')
-rw-r--r--helix-view/src/commands.rs8
-rw-r--r--helix-view/src/document.rs1
2 files changed, 6 insertions, 3 deletions
diff --git a/helix-view/src/commands.rs b/helix-view/src/commands.rs
index b5350ff4..6bf89040 100644
--- a/helix-view/src/commands.rs
+++ b/helix-view/src/commands.rs
@@ -509,13 +509,17 @@ pub fn insert_char_prompt(prompt: &mut Prompt, c: char) {
// Undo / Redo
pub fn undo(view: &mut View, _count: usize) {
- view.doc.history.undo(&mut view.doc.state);
+ if let Some(revert) = view.doc.history.undo() {
+ view.doc.apply(&revert);
+ }
// TODO: each command could simply return a Option<transaction>, then the higher level handles storing it?
}
pub fn redo(view: &mut View, _count: usize) {
- view.doc.history.redo(&mut view.doc.state);
+ if let Some(transaction) = view.doc.history.redo() {
+ view.doc.apply(&transaction);
+ }
}
// Yank / Paste
diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs
index c4b9d081..04018ed6 100644
--- a/helix-view/src/document.rs
+++ b/helix-view/src/document.rs
@@ -108,7 +108,6 @@ impl Document {
};
}
- // TODO: needs to run on undo/redo
pub fn apply(&mut self, transaction: &Transaction) -> bool {
let old_doc = self.text().clone();