Alternative, and hopefully safer implementation of <a-o>/<a-O>
Fixes #1495
This commit is contained in:
parent
81b5de6fd8
commit
74076ef9b7
|
@ -1760,11 +1760,15 @@ void exec_user_mappings(Context& context, NormalParams params)
|
||||||
template<bool above>
|
template<bool above>
|
||||||
void add_empty_line(Context& context, NormalParams params)
|
void add_empty_line(Context& context, NormalParams params)
|
||||||
{
|
{
|
||||||
String new_lines{'\n', CharCount{std::max(params.count, 1)}};
|
int count = std::max(params.count, 1);
|
||||||
SelectionList sels = context.selections();
|
String new_lines{'\n', CharCount{count}};
|
||||||
for (auto& sel : sels)
|
auto& buffer = context.buffer();
|
||||||
sel.set(above ? sel.min().line : sel.max().line+1);
|
auto& sels = context.selections();
|
||||||
sels.insert(new_lines, InsertMode::InsertCursor);
|
for (int i = 0; i < sels.size(); ++i)
|
||||||
|
{
|
||||||
|
auto line = (above ? sels[i].min().line : sels[i].max().line + 1) + (i * count);
|
||||||
|
buffer.insert(line, new_lines);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user