diff --git a/helix-term/tests/test/commands.rs b/helix-term/tests/test/commands.rs index 114bf2221..27dbd9d7c 100644 --- a/helix-term/tests/test/commands.rs +++ b/helix-term/tests/test/commands.rs @@ -283,3 +283,19 @@ async fn test_multi_selection_shell_commands() -> anyhow::Result<()> { Ok(()) } + +#[tokio::test(flavor = "multi_thread")] +async fn test_undo_redo() -> anyhow::Result<()> { + // A jumplist selection is passed through an edit and then an undo and then a redo. + // + // * [ Add a newline at line start. We're now on line 2. + // * Save the selection on line 2 in the jumplist. + // * kd Delete line 1. The jumplist selection should be adjusted to the new line 1. + // * uU Undo and redo the `kd` edit. + // * Jump back in the jumplist. This would panic if the jumplist were not being + // updated correctly. + // * Jump forward to line 1. + test(("#[|]#", "[kduU", "#[|]#")).await?; + + Ok(()) +}