aboutsummaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/ui/editor.rs2
-rw-r--r--helix-term/tests/test/commands.rs9
2 files changed, 10 insertions, 1 deletions
diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs
index 44f89b77..73712503 100644
--- a/helix-term/src/ui/editor.rs
+++ b/helix-term/src/ui/editor.rs
@@ -1424,7 +1424,7 @@ impl Component for EditorView {
// If the current document has been changed, apply the changes to all views.
// This ensures that selections in jumplists follow changes.
if doc.id() == original_doc_id
- && doc.get_current_revision() > original_doc_revision
+ && doc.get_current_revision() != original_doc_revision
{
if let Some(transaction) =
doc.history.get_mut().changes_since(original_doc_revision)
diff --git a/helix-term/tests/test/commands.rs b/helix-term/tests/test/commands.rs
index 27dbd9d7..01295704 100644
--- a/helix-term/tests/test/commands.rs
+++ b/helix-term/tests/test/commands.rs
@@ -286,6 +286,15 @@ async fn test_multi_selection_shell_commands() -> anyhow::Result<()> {
#[tokio::test(flavor = "multi_thread")]
async fn test_undo_redo() -> anyhow::Result<()> {
+ // A jumplist selection is created at a point which is undone.
+ //
+ // * 2[<space> Add two newlines at line start. We're now on line 3.
+ // * <C-s> Save the selection on line 3 in the jumplist.
+ // * u Undo the two newlines. We're now on line 1.
+ // * <C-o><C-i> Jump forward an back again in the jumplist. This would panic
+ // if the jumplist were not being updated correctly.
+ test(("#[|]#", "2[<space><C-s>u<C-o><C-i>", "#[|]#")).await?;
+
// A jumplist selection is passed through an edit and then an undo and then a redo.
//
// * [<space> Add a newline at line start. We're now on line 2.