aboutsummaryrefslogtreecommitdiff
path: root/helix-core/src/transaction.rs
diff options
context:
space:
mode:
authorBlaž Hrastnik2020-10-06 05:44:18 +0000
committerBlaž Hrastnik2020-10-13 14:13:56 +0000
commitb765c17896632e27857c7707a9d3d96bd49b8899 (patch)
tree8c9a95e1244c8839e2c21776bf73baee0a033d94 /helix-core/src/transaction.rs
parent0926904d4c7f8851d53adfad337bac59ac8f8fb4 (diff)
Hacky undo/redo integration.
Diffstat (limited to 'helix-core/src/transaction.rs')
-rw-r--r--helix-core/src/transaction.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/helix-core/src/transaction.rs b/helix-core/src/transaction.rs
index d6b151ba..7871052a 100644
--- a/helix-core/src/transaction.rs
+++ b/helix-core/src/transaction.rs
@@ -369,6 +369,13 @@ impl Transaction {
return false;
}
+ // Compose this transaction with the previous one
+ let old_changes = state.changes.take();
+ state.changes = Some(old_changes.map_or_else(
+ || self.changes.clone(),
+ |changes| changes.compose(self.changes.clone()).unwrap(),
+ ));
+
if let Some(syntax) = &mut state.syntax {
// TODO: no unwrap
syntax.update(&old_doc, &state.doc, &self.changes).unwrap();