From 9a780a8cb9524f06da5de7e647933454efc5c9cf Mon Sep 17 00:00:00 2001 From: "Dubrovin E. Iu." Date: Tue, 17 Jun 2025 15:56:33 +0300 Subject: [PATCH] the behavior of `copy_selection_on_visual_line` has changed so that, if `count` > 1, then the selection is copied to the relative line number, instead of copying it `count` times --- helix-term/src/commands.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index ac1e0d129..0cc366665 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -1978,7 +1978,8 @@ fn copy_selection_on_visual_line(cx: &mut Context, direction: Direction) { let mut primary_idx = selection.primary_index(); let mut new_ranges = SmallVec::with_capacity(selection.len() * (count + 1)); new_ranges.extend_from_slice(selection.ranges()); - //TODO: copy the selection to the relative line number if `count` > 1 + //copy the selection to the relative line number + let to_relative_line_number = count > 1; for range in selection.iter() { let is_primary = *range == selection.primary(); @@ -2027,8 +2028,10 @@ fn copy_selection_on_visual_line(cx: &mut Context, direction: Direction) { Range::point(new_anchor) .put_cursor(text, new_head, true) ); if is_primary { primary_idx = new_ranges.len() - 1 } - step += 1; + if ! to_relative_line_number { step += 1 } } + // always increment if `count` > 1 + if to_relative_line_number { step += 1 } // check the top doc boundary if new_head == 0