@@ -2315,9 +2315,8 @@ fn delete_selection_impl(cx: &mut Context, op: Operation) {
23152315 };
23162316
23172317 // then delete
2318− let transaction = Transaction::change_by_selection(doc.text(), selection, |range| {
2319− (range.from(), range.to(), None)
2320− });
2318+ let transaction =
2319+ Transaction::delete_by_selection(doc.text(), selection, |range| (range.from(), range.to()));
23212320 doc.apply(&transaction, view.id);
23222321
23232322 match op {
@@ -2333,9 +2332,8 @@ fn delete_selection_impl(cx: &mut Context, op: Operation) {
23332332
23342333#[inline]
23352334fn delete_selection_insert_mode(doc: &mut Document, view: &mut View, selection: &Selection) {
2336− let transaction = Transaction::change_by_selection(doc.text(), selection, |range| {
2337− (range.from(), range.to(), None)
2338− });
2335+ let transaction =
2336+ Transaction::delete_by_selection(doc.text(), selection, |range| (range.from(), range.to()));
23392337 doc.apply(&transaction, view.id);
23402338}
23412339
@@ -3422,10 +3420,10 @@ pub mod insert {
34223420 let auto_pairs = doc.auto_pairs(cx.editor);
34233421
34243422 let transaction =
3425− Transaction::change_by_selection(doc.text(), doc.selection(view.id), |range| {
3423+ Transaction::delete_by_selection(doc.text(), doc.selection(view.id), |range| {
34263424 let pos = range.cursor(text);
34273425 if pos == 0 {
3428− return (pos, pos, None);
3426+ return (pos, pos);
34293427 }
34303428 let line_start_pos = text.line_to_char(range.cursor_line(text));
34313429 // consider to delete by indent level if all characters before `pos` are indent units.
@@ -3433,11 +3431,7 @@ pub mod insert {
34333431 if !fragment.is_empty() && fragment.chars().all(|ch| ch == ' ' || ch == '\t') {
34343432 if text.get_char(pos.saturating_sub(1)) == Some('\t') {
34353433 // fast path, delete one char
3436− (
3437− graphemes::nth_prev_grapheme_boundary(text, pos, 1),
3438− pos,
3439− None,
3440− )
3434+ (graphemes::nth_prev_grapheme_boundary(text, pos, 1), pos)
34413435 } else {
34423436 let width: usize = fragment
34433437 .chars()
@@ -3464,7 +3458,7 @@ pub mod insert {
34643458 _ => break,
34653459 }
34663460 }
3467− (start, pos, None) // delete!
3461+ (start, pos) // delete!
34683462 }
34693463 } else {
34703464 match (
@@ -3482,17 +3476,12 @@ pub mod insert {
34823476 (
34833477 graphemes::nth_prev_grapheme_boundary(text, pos, count),
34843478 graphemes::nth_next_grapheme_boundary(text, pos, count),
3485− None,
34863479 )
34873480 }
34883481 _ =>
34893482 // delete 1 char
34903483 {
3491− (
3492− graphemes::nth_prev_grapheme_boundary(text, pos, count),
3493− pos,
3494− None,
3495− )
3484+ (graphemes::nth_prev_grapheme_boundary(text, pos, count), pos)
34963485 }
34973486 }
34983487 }
@@ -3508,13 +3497,9 @@ pub mod insert {
35083497 let (view, doc) = current!(cx.editor);
35093498 let text = doc.text().slice(..);
35103499 let transaction =
3511− Transaction::change_by_selection(doc.text(), doc.selection(view.id), |range| {
3500+ Transaction::delete_by_selection(doc.text(), doc.selection(view.id), |range| {
35123501 let pos = range.cursor(text);
3513− (
3514− pos,
3515− graphemes::nth_next_grapheme_boundary(text, pos, count),
3516− None,
3517− )
3502+ (pos, graphemes::nth_next_grapheme_boundary(text, pos, count))
35183503 });
35193504 doc.apply(&transaction, view.id);
35203505