aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/commands.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index ef963477..ae9e35f1 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -3476,6 +3476,7 @@ fn paste_impl(values: &[String], doc: &mut Document, view: &mut View, action: Pa
let text = doc.text();
let selection = doc.selection(view.id);
+ let mut offset = 0;
let mut ranges = SmallVec::with_capacity(selection.len());
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
.as_ref()
.map(|content| content.chars().count())
.unwrap_or_default();
+ let anchor = offset + pos;
- ranges.push(Range::new(pos, pos + value_len));
+ let new_range = Range::new(anchor, anchor + value_len).with_direction(range.direction());
+ ranges.push(new_range);
+ offset += value_len;
(pos, pos, value)
});