From 220be30f02c8085258bd0e5e26fafe5ac88fad89 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 24 Jan 2018 10:33:22 +1100 Subject: [PATCH] Support multiline selections in C/ Fixes #1725 --- src/normal.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/normal.cc b/src/normal.cc index 6208d01b..bcee1b63 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -1287,9 +1287,10 @@ void copy_selections_on_next_lines(Context& context, NormalParams params) if (is_main) main_index = result.size(); result.push_back(std::move(sel)); + const LineCount height = std::max(anchor.line, cursor.line) - std::min(anchor.line, cursor.line) + 1; for (int i = 0; i < std::max(params.count, 1); ++i) { - LineCount offset = (direction == Forward ? 1 : -1) * (i + 1); + LineCount offset = (direction == Forward ? 1 : -1) * (i + 1) * height; const LineCount anchor_line = anchor.line + offset; const LineCount cursor_line = cursor.line + offset;