aboutsummaryrefslogtreecommitdiff
path: root/helix-core/src
diff options
context:
space:
mode:
authorMichael Davis2022-12-03 03:09:08 +0000
committerGitHub2022-12-03 03:09:08 +0000
commitbcdb475b71b0fbabce57344ac8d2575c23b1bbe0 (patch)
tree0714f3a4bf64caee607208b7b3a64409f1ad0f55 /helix-core/src
parentdc00291b4888f7ffad43fd544259227d0dbbf6fb (diff)
Fix transaction composition order in History::changes_since (#4981)
* Add a undo/redo split test case for crossing branches * history: Switch up/down transaction chaining order The old code tends to work in practice because, usually, either up_txns or down_txns are empty. When both have contents though, we can run into a panic trying to compose them all since they will disagree on the length of the text. This fixes the panic test case in the parent commit.
Diffstat (limited to 'helix-core/src')
-rw-r--r--helix-core/src/history.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/helix-core/src/history.rs b/helix-core/src/history.rs
index b99e969f..1aac38d9 100644
--- a/helix-core/src/history.rs
+++ b/helix-core/src/history.rs
@@ -131,7 +131,7 @@ impl History {
.map(|&n| self.revisions[n].inversion.clone());
let down_txns = down.iter().map(|&n| self.revisions[n].transaction.clone());
- up_txns.chain(down_txns).reduce(|acc, tx| tx.compose(acc))
+ down_txns.chain(up_txns).reduce(|acc, tx| tx.compose(acc))
}
/// Undo the last edit.