aboutsummaryrefslogtreecommitdiff
path: root/helix-term/tests/test/splits.rs
diff options
context:
space:
mode:
Diffstat (limited to 'helix-term/tests/test/splits.rs')
-rw-r--r--helix-term/tests/test/splits.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/helix-term/tests/test/splits.rs b/helix-term/tests/test/splits.rs
index a34a24b7..96ced21a 100644
--- a/helix-term/tests/test/splits.rs
+++ b/helix-term/tests/test/splits.rs
@@ -161,5 +161,30 @@ async fn test_changes_in_splits_apply_to_all_views() -> anyhow::Result<()> {
))
.await?;
+ // See <https://github.com/helix-editor/helix/issues/4957>.
+ // This sequence undoes part of the history and then adds new changes, creating a
+ // new branch in the history tree. `View::sync_changes` applies transactions down
+ // and up to the lowest common ancestor in the path between old and new revision
+ // numbers. If we apply these up/down transactions in the wrong order, this case
+ // panics.
+ // The key sequence:
+ // * 3[<space> Create three empty lines so we are at the end of the document.
+ // * <C-w>v<C-s> Create a split and save that point at the end of the document
+ // in the jumplist.
+ // * <C-w>w Switch back to the first window.
+ // * uu Undo twice (not three times which would bring us back to the
+ // root of the tree).
+ // * 3[<space> Create three empty lines. Now the end of the document is past
+ // where it was on step 1.
+ // * <C-w>q Close window 1, focusing window 2 and causing a sync. This step
+ // panics if we don't apply in the right order.
+ // * %d Clean up the buffer.
+ test((
+ "#[|]#",
+ "3[<space><C-w>v<C-s><C-w>wuu3[<space><C-w>q%d",
+ "#[|]#",
+ ))
+ .await?;
+
Ok(())
}