summaryrefslogtreecommitdiff
path: root/helix-view/src/lib.rs
diff options
context:
space:
mode:
authorMichael Davis2022-11-23 03:28:49 +0000
committerGitHub2022-11-23 03:28:49 +0000
commit42e37a571e75aaf4feb1717dfebe8cf215e535dd (patch)
tree385e494b1d10ce6d40b59162dae0b059d4eeb583 /helix-view/src/lib.rs
parent642a961c032b2a7e7fa67bfc3da54588d0ae8c5b (diff)
Apply transactions to all views (#4733)
* Add a test case for updating jumplists across windows * Apply transactions to all views on history changes This ensures that jumplist selections follow changes in documents, even when there are multiple views (for example a split where both windows edit the same document). * Leave TODOs for cleaning up View::apply * Use Iterator::reduce to compose history transactions Co-authored-by: Blaž Hrastnik <blaz@mxxn.io> Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
Diffstat (limited to 'helix-view/src/lib.rs')
-rw-r--r--helix-view/src/lib.rs8
1 files changed, 3 insertions, 5 deletions
diff --git a/helix-view/src/lib.rs b/helix-view/src/lib.rs
index 4c32b356..9cf36ae0 100644
--- a/helix-view/src/lib.rs
+++ b/helix-view/src/lib.rs
@@ -71,12 +71,10 @@ pub fn align_view(doc: &Document, view: &mut View, align: Align) {
pub fn apply_transaction(
transaction: &helix_core::Transaction,
doc: &mut Document,
- view: &mut View,
+ view: &View,
) -> bool {
- // This is a short function but it's easy to call `Document::apply`
- // without calling `View::apply` or in the wrong order. The transaction
- // must be applied to the document before the view.
- doc.apply(transaction, view.id) && view.apply(transaction, doc)
+ // TODO remove this helper function. Just call Document::apply everywhere directly.
+ doc.apply(transaction, view.id)
}
pub use document::Document;