aboutsummaryrefslogtreecommitdiff
path: root/helix-view/src
diff options
context:
space:
mode:
authorBlaž Hrastnik2020-10-23 02:32:25 +0000
committerBlaž Hrastnik2020-12-03 04:10:35 +0000
commitc0e17dd324f016401d56d66b7c113dada0644155 (patch)
treea2d66d29cac70641af4811182b80e319426527f7 /helix-view/src
parentb39849dde1b1277d14dbc4e2e1604e5d020db43d (diff)
Fix undo/redo not updating the syntax tree.
Diffstat (limited to 'helix-view/src')
-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();