on master help sign in
Use helix_view::apply_transaction in integration-tests

`helix_view::apply_transaction` closes over `Document::apply` and `View::apply` to ensure that jumplist entries are updated when a document changes from a transaction. `Document::apply` shouldn't be called directly - this helper function should be used instead.

commit1243db11a55a9f431a4b6bbf56c1953b2262d8b7 authorMichael Davis <mcarsondavis@gmail.com> dateThu 20 Oct 2022, 13:36 (4 years ago) parent4cff625
1 file changed+7−8
helix-term/tests/test/helpers.rs+7−8
helix-term/tests/test/helpers.rs+7−8
@@ -125,13 +125,12 @@ pub async fn test_key_sequence_with_input_text<T: Into<TestCase>>(
125125 let sel = doc.selection(view.id).clone();
126126
127127 // replace the initial text with the input text
128− doc.apply(
129− &Transaction::change_by_selection(doc.text(), &sel, |_| {
130− (0, doc.text().len_chars(), Some((&test_case.in_text).into()))
131− })
132− .with_selection(test_case.in_selection.clone()),
133− view.id,
134− );
128+ let transaction = Transaction::change_by_selection(doc.text(), &sel, |_| {
129+ (0, doc.text().len_chars(), Some((&test_case.in_text).into()))
130+ })
131+ .with_selection(test_case.in_selection.clone());
132+
133+ helix_view::apply_transaction(&transaction, doc, view);
135134
136135 test_key_sequence(
137136 &mut app,
@@ -286,7 +285,7 @@ impl AppBuilder {
286285 .with_selection(selection);
287286
288287 // replace the initial text with the input text
289− doc.apply(&trans, view.id);
288+ helix_view::apply_transaction(&trans, doc, view);
290289 }
291290
292291 Ok(app)