From 0aedef03334dfc0cb2a723cce23abc5b4ca55a22 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Mon, 10 Oct 2022 14:56:26 -0500 Subject: Apply transactions to Views This change adds View::apply calls for all Document::apply call-sites, ensuring that changes to a document do not leave invalid entries in the View's jumplist. --- helix-term/src/commands/typed.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'helix-term/src/commands/typed.rs') diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index 96ff75c5..574e895b 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -463,6 +463,7 @@ fn set_line_ending( }), ); doc.apply(&transaction, view.id); + view.apply(&transaction, doc); doc.append_changes_to_history(view.id); Ok(()) @@ -884,6 +885,7 @@ fn replace_selections_with_clipboard_impl( }); doc.apply(&transaction, view.id); + view.apply(&transaction, doc); doc.append_changes_to_history(view.id); Ok(()) } @@ -1004,7 +1006,7 @@ fn reload( let scrolloff = cx.editor.config().scrolloff; let (view, doc) = current!(cx.editor); - doc.reload(view.id).map(|_| { + doc.reload(view).map(|_| { view.ensure_cursor_in_view(doc, scrolloff); }) } @@ -1399,6 +1401,7 @@ fn sort_impl( ); doc.apply(&transaction, view.id); + view.apply(&transaction, doc); doc.append_changes_to_history(view.id); Ok(()) @@ -1443,6 +1446,7 @@ fn reflow( }); doc.apply(&transaction, view.id); + view.apply(&transaction, doc); doc.append_changes_to_history(view.id); view.ensure_cursor_in_view(doc, scrolloff); -- cgit v1.2.3-70-g09d2