diff options
author | Michael Davis | 2022-10-10 19:56:26 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2022-10-11 03:17:32 +0000 |
commit | 0aedef03334dfc0cb2a723cce23abc5b4ca55a22 (patch) | |
tree | 17e017760f23147c821bb25b0af027c47b08f10b /helix-term/src/ui | |
parent | d418f0795d8a33c83ad87c5530c4819d83da09ef (diff) |
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.
Diffstat (limited to 'helix-term/src/ui')
-rw-r--r-- | helix-term/src/ui/completion.rs | 7 | ||||
-rw-r--r-- | helix-term/src/ui/editor.rs | 3 |
2 files changed, 7 insertions, 3 deletions
diff --git a/helix-term/src/ui/completion.rs b/helix-term/src/ui/completion.rs index 2d7d4f92..c0a5da2e 100644 --- a/helix-term/src/ui/completion.rs +++ b/helix-term/src/ui/completion.rs @@ -143,11 +143,11 @@ impl Completion { let (view, doc) = current!(editor); // if more text was entered, remove it - doc.restore(view.id); + doc.restore(view); match event { PromptEvent::Abort => { - doc.restore(view.id); + doc.restore(view); editor.last_completion = None; } PromptEvent::Update => { @@ -165,6 +165,7 @@ impl Completion { // initialize a savepoint doc.savepoint(); doc.apply(&transaction, view.id); + view.apply(&transaction, doc); editor.last_completion = Some(CompleteAction { trigger_offset, @@ -184,6 +185,7 @@ impl Completion { ); doc.apply(&transaction, view.id); + view.apply(&transaction, doc); editor.last_completion = Some(CompleteAction { trigger_offset, @@ -214,6 +216,7 @@ impl Completion { offset_encoding, // TODO: should probably transcode in Client ); doc.apply(&transaction, view.id); + view.apply(&transaction, doc); } } } diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index 18e1271f..3b71748b 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -988,7 +988,7 @@ impl EditorView { InsertEvent::CompletionApply(compl) => { let (view, doc) = current!(cxt.editor); - doc.restore(view.id); + doc.restore(view); let text = doc.text().slice(..); let cursor = doc.selection(view.id).primary().cursor(text); @@ -1003,6 +1003,7 @@ impl EditorView { }), ); doc.apply(&tx, view.id); + view.apply(&tx, doc); } InsertEvent::TriggerCompletion => { let (_, doc) = current!(cxt.editor); |