@@ -26,7 +26,6 @@ use helix_core::{
2626 SmallVec, Tendril, Transaction,
2727};
2828use helix_view::{
29− apply_transaction,
3029 clipboard::ClipboardType,
3130 document::{FormatterError, Mode, SCRATCH_BUFFER_NAME},
3231 editor::{Action, Motion},
@@ -864,7 +863,7 @@ fn align_selections(cx: &mut Context) {
864863 changes.sort_unstable_by_key(|(from, _, _)| *from);
865864
866865 let transaction = Transaction::change(doc.text(), changes.into_iter());
867− apply_transaction(&transaction, doc, view);
866+ doc.apply(&transaction, view.id);
868867}
869868
870869fn goto_window(cx: &mut Context, align: Align) {
@@ -1316,7 +1315,7 @@ fn replace(cx: &mut Context) {
13161315 }
13171316 });
13181317
1319− apply_transaction(&transaction, doc, view);
1318+ doc.apply(&transaction, view.id);
13201319 exit_select_mode(cx);
13211320 }
13221321 })
@@ -1334,7 +1333,7 @@ where
13341333 (range.from(), range.to(), Some(text))
13351334 });
13361335
1337− apply_transaction(&transaction, doc, view);
1336+ doc.apply(&transaction, view.id);
13381337}
13391338
13401339fn switch_case(cx: &mut Context) {
@@ -2159,7 +2158,7 @@ fn delete_selection_impl(cx: &mut Context, op: Operation) {
21592158 let transaction = Transaction::change_by_selection(doc.text(), selection, |range| {
21602159 (range.from(), range.to(), None)
21612160 });
2162− apply_transaction(&transaction, doc, view);
2161+ doc.apply(&transaction, view.id);
21632162
21642163 match op {
21652164 Operation::Delete => {
@@ -2177,7 +2176,7 @@ fn delete_selection_insert_mode(doc: &mut Document, view: &mut View, selection:
21772176 let transaction = Transaction::change_by_selection(doc.text(), selection, |range| {
21782177 (range.from(), range.to(), None)
21792178 });
2180− apply_transaction(&transaction, doc, view);
2179+ doc.apply(&transaction, view.id);
21812180}
21822181
21832182fn delete_selection(cx: &mut Context) {
@@ -2273,7 +2272,7 @@ fn append_mode(cx: &mut Context) {
22732272 doc.text(),
22742273 [(end, end, Some(doc.line_ending.as_str().into()))].into_iter(),
22752274 );
2276− apply_transaction(&transaction, doc, view);
2275+ doc.apply(&transaction, view.id);
22772276 }
22782277
22792278 let selection = doc.selection(view.id).clone().transform(|range| {
@@ -2583,7 +2582,7 @@ async fn make_format_callback(
25832582
25842583 if let Ok(format) = format {
25852584 if doc.version() == doc_version {
2586− apply_transaction(&format, doc, view);
2585+ doc.apply(&format, view.id);
25872586 doc.append_changes_to_history(view);
25882587 doc.detect_indent_and_line_ending();
25892588 view.ensure_cursor_in_view(doc, scrolloff);
@@ -2676,7 +2675,7 @@ fn open(cx: &mut Context, open: Open) {
26762675
26772676 transaction = transaction.with_selection(Selection::new(ranges, selection.primary_index()));
26782677
2679− apply_transaction(&transaction, doc, view);
2678+ doc.apply(&transaction, view.id);
26802679}
26812680
26822681// o inserts a new line after each line with a selection
@@ -3104,7 +3103,7 @@ pub mod insert {
31043103
31053104 let (view, doc) = current!(cx.editor);
31063105 if let Some(t) = transaction {
3107− apply_transaction(&t, doc, view);
3106+ doc.apply(&t, view.id);
31083107 }
31093108
31103109 // TODO: need a post insert hook too for certain triggers (autocomplete, signature help, etc)
@@ -3126,7 +3125,7 @@ pub mod insert {
31263125 &doc.selection(view.id).clone().cursors(doc.text().slice(..)),
31273126 indent,
31283127 );
3129− apply_transaction(&transaction, doc, view);
3128+ doc.apply(&transaction, view.id);
31303129 }
31313130
31323131 pub fn insert_newline(cx: &mut Context) {
@@ -3231,7 +3230,7 @@ pub mod insert {
32313230 transaction = transaction.with_selection(Selection::new(ranges, selection.primary_index()));
32323231
32333232 let (view, doc) = current!(cx.editor);
3234− apply_transaction(&transaction, doc, view);
3233+ doc.apply(&transaction, view.id);
32353234 }
32363235
32373236 pub fn delete_char_backward(cx: &mut Context) {
@@ -3326,7 +3325,7 @@ pub mod insert {
33263325 }
33273326 });
33283327 let (view, doc) = current!(cx.editor);
3329− apply_transaction(&transaction, doc, view);
3328+ doc.apply(&transaction, view.id);
33303329
33313330 lsp::signature_help_impl(cx, SignatureHelpInvoked::Automatic);
33323331 }
@@ -3344,7 +3343,7 @@ pub mod insert {
33443343 None,
33453344 )
33463345 });
3347− apply_transaction(&transaction, doc, view);
3346+ doc.apply(&transaction, view.id);
33483347
33493348 lsp::signature_help_impl(cx, SignatureHelpInvoked::Automatic);
33503349 }
@@ -3625,7 +3624,7 @@ fn paste_impl(
36253624 transaction = transaction.with_selection(Selection::new(ranges, selection.primary_index()));
36263625 }
36273626
3628− apply_transaction(&transaction, doc, view);
3627+ doc.apply(&transaction, view.id);
36293628}
36303629
36313630pub(crate) fn paste_bracketed_value(cx: &mut Context, contents: String) {
@@ -3717,7 +3716,7 @@ fn replace_with_yanked(cx: &mut Context) {
37173716 }
37183717 });
37193718
3720− apply_transaction(&transaction, doc, view);
3719+ doc.apply(&transaction, view.id);
37213720 exit_select_mode(cx);
37223721 }
37233722 }
@@ -3741,7 +3740,7 @@ fn replace_selections_with_clipboard_impl(
37413740 )
37423741 });
37433742
3744− apply_transaction(&transaction, doc, view);
3743+ doc.apply(&transaction, view.id);
37453744 doc.append_changes_to_history(view);
37463745 }
37473746 Err(e) => return Err(e.context("Couldn't get system clipboard contents")),
@@ -3813,7 +3812,7 @@ fn indent(cx: &mut Context) {
38133812 Some((pos, pos, Some(indent.clone())))
38143813 }),
38153814 );
3816− apply_transaction(&transaction, doc, view);
3815+ doc.apply(&transaction, view.id);
38173816}
38183817
38193818fn unindent(cx: &mut Context) {
@@ -3852,7 +3851,7 @@ fn unindent(cx: &mut Context) {
38523851
38533852 let transaction = Transaction::change(doc.text(), changes.into_iter());
38543853
3855− apply_transaction(&transaction, doc, view);
3854+ doc.apply(&transaction, view.id);
38563855}
38573856
38583857fn format_selections(cx: &mut Context) {
@@ -3907,7 +3906,7 @@ fn format_selections(cx: &mut Context) {
39073906 language_server.offset_encoding(),
39083907 );
39093908
3910− apply_transaction(&transaction, doc, view);
3909+ doc.apply(&transaction, view.id);
39113910}
39123911
39133912fn join_selections_impl(cx: &mut Context, select_space: bool) {
@@ -3966,7 +3965,7 @@ fn join_selections_impl(cx: &mut Context, select_space: bool) {
39663965 Transaction::change(doc.text(), changes.into_iter())
39673966 };
39683967
3969− apply_transaction(&transaction, doc, view);
3968+ doc.apply(&transaction, view.id);
39703969}
39713970
39723971fn keep_or_remove_selections_impl(cx: &mut Context, remove: bool) {
@@ -4109,7 +4108,7 @@ fn toggle_comments(cx: &mut Context) {
41094108 .map(|tc| tc.as_ref());
41104109 let transaction = comment::toggle_line_comments(doc.text(), doc.selection(view.id), token);
41114110
4112− apply_transaction(&transaction, doc, view);
4111+ doc.apply(&transaction, view.id);
41134112 exit_select_mode(cx);
41144113}
41154114
@@ -4165,7 +4164,7 @@ fn rotate_selection_contents(cx: &mut Context, direction: Direction) {
41654164 .map(|(range, fragment)| (range.from(), range.to(), Some(fragment))),
41664165 );
41674166
4168− apply_transaction(&transaction, doc, view);
4167+ doc.apply(&transaction, view.id);
41694168}
41704169
41714170fn rotate_selection_contents_forward(cx: &mut Context) {
@@ -4698,7 +4697,7 @@ fn surround_add(cx: &mut Context) {
46984697
46994698 let transaction = Transaction::change(doc.text(), changes.into_iter())
47004699 .with_selection(Selection::new(ranges, selection.primary_index()));
4701− apply_transaction(&transaction, doc, view);
4700+ doc.apply(&transaction, view.id);
47024701 exit_select_mode(cx);
47034702 })
47044703}
@@ -4738,7 +4737,7 @@ fn surround_replace(cx: &mut Context) {
47384737 (pos, pos + 1, Some(t))
47394738 }),
47404739 );
4741− apply_transaction(&transaction, doc, view);
4740+ doc.apply(&transaction, view.id);
47424741 exit_select_mode(cx);
47434742 });
47444743 })
@@ -4766,7 +4765,7 @@ fn surround_delete(cx: &mut Context) {
47664765
47674766 let transaction =
47684767 Transaction::change(doc.text(), change_pos.into_iter().map(|p| (p, p + 1, None)));
4769− apply_transaction(&transaction, doc, view);
4768+ doc.apply(&transaction, view.id);
47704769 exit_select_mode(cx);
47714770 })
47724771}
@@ -4981,7 +4980,7 @@ fn shell(cx: &mut compositor::Context, cmd: &str, behavior: &ShellBehavior) {
49814980 if behavior != &ShellBehavior::Ignore {
49824981 let transaction = Transaction::change(doc.text(), changes.into_iter())
49834982 .with_selection(Selection::new(ranges, selection.primary_index()));
4984− apply_transaction(&transaction, doc, view);
4983+ doc.apply(&transaction, view.id);
49854984 doc.append_changes_to_history(view);
49864985 }
49874986
@@ -5044,7 +5043,7 @@ fn add_newline_impl(cx: &mut Context, open: Open) {
50445043 });
50455044
50465045 let transaction = Transaction::change(text, changes);
5047− apply_transaction(&transaction, doc, view);
5046+ doc.apply(&transaction, view.id);
50485047}
50495048
50505049enum IncrementDirection {
@@ -5111,7 +5110,7 @@ fn increment_impl(cx: &mut Context, increment_direction: IncrementDirection) {
51115110 let new_selection = Selection::new(new_selection_ranges, selection.primary_index());
51125111 let transaction = Transaction::change(doc.text(), changes.into_iter());
51135112 let transaction = transaction.with_selection(new_selection);
5114− apply_transaction(&transaction, doc, view);
5113+ doc.apply(&transaction, view.id);
51155114 }
51165115}
51175116