diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 906f201a..babfb2c8 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -1971,7 +1971,7 @@ fn extend_line_impl(cx: &mut Context, extend: Extend) { let (start_line, end_line) = range.line_range(text.slice(..)); let start = text.line_to_char(match extend { - Extend::Above => start_line.saturating_sub(count), + Extend::Above => start_line.saturating_sub(count - 1), Extend::Below => start_line, }); let end = text.line_to_char( @@ -1985,7 +1985,7 @@ fn extend_line_impl(cx: &mut Context, extend: Extend) { // extend to previous/next line if current line is selected let (anchor, head) = if range.from() == start && range.to() == end { match extend { - Extend::Above => (end, text.line_to_char(start_line.saturating_sub(count + 1))), + Extend::Above => (end, text.line_to_char(start_line.saturating_sub(count))), Extend::Below => ( start, text.line_to_char((end_line + count + 1).min(text.len_lines())),