Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-term/src/commands.rs')
-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 3b906487..755a7dc0 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -3474,6 +3474,7 @@ fn open(cx: &mut Context, open: Open) {
let text = doc.text().slice(..);
let contents = doc.text();
let selection = doc.selection(view.id);
+ let mut offs = 0;
let mut ranges = SmallVec::with_capacity(selection.len());
@@ -3550,7 +3551,7 @@ fn open(cx: &mut Context, open: Open) {
let text = text.repeat(count);
// calculate new selection ranges
- let pos = above_next_line_end_index + above_next_line_end_width;
+ let pos = offs + above_next_line_end_index + above_next_line_end_width;
let comment_len = continue_comment_token
.map(|token| token.len() + 1) // `+ 1` for the extra space added
.unwrap_or_default();
@@ -3563,6 +3564,9 @@ fn open(cx: &mut Context, open: Open) {
));
}
+ // update the offset for the next range
+ offs += text.chars().count();
+
(
above_next_line_end_index,
above_next_line_end_index,