summaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
authorMichael Davis2022-11-23 15:35:07 +0000
committerBlaž Hrastnik2022-11-24 01:57:12 +0000
commit4a103db6228ba54e0f36bbebb95d25867458f473 (patch)
tree662f8d99f77f955156b3839d245a228bd71e5cd7 /helix-term/src
parentfd00f3a70eb626242bb2fcc9bddf2c4d94580a9a (diff)
Apply inversions to Views on undo/redo
When using undo/redo, the history revision can be decremented. In that case we should apply the inversions since the given revision in History::changes_since. This prevents panics with jumplist operations when a session uses undo/redo to move the jumplist selection outside of the document.
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/ui/editor.rs2
1 files changed, 1 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)