@@ -2315,9 +2315,8 @@ fn delete_selection_impl(cx: &mut Context, op: Operation) {
2317 // then delete
2317 // then delete
2318− let transaction = Transaction::change_by_selection(doc.text(), selection, |range| {
2319+ Transaction::delete_by_selection(doc.text(), selection, |range| (range.from(), range.to()));
2319− (range.from(), range.to(), None)
2321 doc.apply(&transaction, view.id);
2320 doc.apply(&transaction, view.id);
2323 match op {
2322 match op {
@@ -2333,9 +2332,8 @@ fn delete_selection_impl(cx: &mut Context, op: Operation) {
2334#[inline]
2333#[inline]
2335fn delete_selection_insert_mode(doc: &mut Document, view: &mut View, selection: &Selection) {
2334fn delete_selection_insert_mode(doc: &mut Document, view: &mut View, selection: &Selection) {
2336− let transaction = Transaction::change_by_selection(doc.text(), selection, |range| {
2336+ Transaction::delete_by_selection(doc.text(), selection, |range| (range.from(), range.to()));
2337− (range.from(), range.to(), None)
2339 doc.apply(&transaction, view.id);
2337 doc.apply(&transaction, view.id);
@@ -3422,10 +3420,10 @@ pub mod insert {
3422 let auto_pairs = doc.auto_pairs(cx.editor);
3420 let auto_pairs = doc.auto_pairs(cx.editor);
3424 let transaction =
3422 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| {
3426 let pos = range.cursor(text);
3424 let pos = range.cursor(text);
3427 if pos == 0 {
3425 if pos == 0 {
3428− return (pos, pos, None);
3426+ return (pos, pos);
3430 let line_start_pos = text.line_to_char(range.cursor_line(text));
3428 let line_start_pos = text.line_to_char(range.cursor_line(text));
3431 // consider to delete by indent level if all characters before `pos` are indent units.
3429 // consider to delete by indent level if all characters before `pos` are indent units.
@@ -3433,11 +3431,7 @@ pub mod insert {
3433 if !fragment.is_empty() && fragment.chars().all(|ch| ch == ' ' || ch == '\t') {
3431 if !fragment.is_empty() && fragment.chars().all(|ch| ch == ' ' || ch == '\t') {
3434 if text.get_char(pos.saturating_sub(1)) == Some('\t') {
3432 if text.get_char(pos.saturating_sub(1)) == Some('\t') {
3435 // fast path, delete one char
3433 // fast path, delete one char
3437− graphemes::nth_prev_grapheme_boundary(text, pos, 1),
3434+ (graphemes::nth_prev_grapheme_boundary(text, pos, 1), pos)
3441 } else {
3435 } else {
3442 let width: usize = fragment
3436 let width: usize = fragment
3443 .chars()
3437 .chars()
@@ -3464,7 +3458,7 @@ pub mod insert {
3464 _ => break,
3458 _ => break,
3467− (start, pos, None) // delete!
3461+ (start, pos) // delete!
3469 } else {
3463 } else {
@@ -3482,17 +3476,12 @@ pub mod insert {
3483 graphemes::nth_prev_grapheme_boundary(text, pos, count),
3477 graphemes::nth_prev_grapheme_boundary(text, pos, count),
3484 graphemes::nth_next_grapheme_boundary(text, pos, count),
3478 graphemes::nth_next_grapheme_boundary(text, pos, count),
3489 // delete 1 char
3482 // delete 1 char
3492− graphemes::nth_prev_grapheme_boundary(text, pos, count),
3484+ (graphemes::nth_prev_grapheme_boundary(text, pos, count), pos)
@@ -3508,13 +3497,9 @@ pub mod insert {
3508 let (view, doc) = current!(cx.editor);
3497 let (view, doc) = current!(cx.editor);
3509 let text = doc.text().slice(..);
3498 let text = doc.text().slice(..);
3510 let transaction =
3499 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| {
3512 let pos = range.cursor(text);
3501 let pos = range.cursor(text);
3515− graphemes::nth_next_grapheme_boundary(text, pos, count),
3502+ (pos, graphemes::nth_next_grapheme_boundary(text, pos, count))
3519 doc.apply(&transaction, view.id);
3504 doc.apply(&transaction, view.id);