@@ -3476,6 +3476,7 @@ fn paste_impl(values: &[String], doc: &mut Document, view: &mut View, action: Pa
3476 let text = doc.text();
3476 let text = doc.text();
3477 let selection = doc.selection(view.id);
3477 let selection = doc.selection(view.id);
3479+ let mut offset = 0;
3479 let mut ranges = SmallVec::with_capacity(selection.len());
3480 let mut ranges = SmallVec::with_capacity(selection.len());
3481 let transaction = Transaction::change_by_selection(text, selection, |range| {
3482 let transaction = Transaction::change_by_selection(text, selection, |range| {
@@ -3501,8 +3502,11 @@ fn paste_impl(values: &[String], doc: &mut Document, view: &mut View, action: Pa
3501 .as_ref()
3502 .as_ref()
3502 .map(|content| content.chars().count())
3503 .map(|content| content.chars().count())
3503 .unwrap_or_default();
3504 .unwrap_or_default();
3505+ let anchor = offset + pos;
3505− ranges.push(Range::new(pos, pos + value_len));
3507+ let new_range = Range::new(anchor, anchor + value_len).with_direction(range.direction());
3508+ ranges.push(new_range);
3509+ offset += value_len;
3507 (pos, pos, value)
3511 (pos, pos, value)