Support multiline selections in C/<a-C>

Fixes #1725
This commit is contained in:
Maxime Coste 2018-01-24 10:33:22 +11:00
parent b677797b92
commit 220be30f02

View File

@ -1287,9 +1287,10 @@ void copy_selections_on_next_lines(Context& context, NormalParams params)
if (is_main) if (is_main)
main_index = result.size(); main_index = result.size();
result.push_back(std::move(sel)); 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) 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 anchor_line = anchor.line + offset;
const LineCount cursor_line = cursor.line + offset; const LineCount cursor_line = cursor.line + offset;