Fix potential assert on itersel selection restoration

We cannot guarantee after an itersel that selections are going to
still be in ascending order, but we were calling a SelectionList
constructor that was assuming this was the case.
This commit is contained in:
Maxime Coste 2018-05-24 08:03:30 +10:00
parent 36e7e93f78
commit 9b89652b0b
4 changed files with 9 additions and 4 deletions

View File

@ -1662,16 +1662,16 @@ void context_wrap(const ParametersParser& parser, Context& context, Func func)
update_selections(new_sels, main, c.buffer(), timestamp);
timestamp = c.buffer().timestamp();
if (&sel == &sels.main())
main = new_sels.size() + c.selections().main_index();
for (auto& sel : c.selections())
new_sels.push_back(sel);
}
}
if (not draft)
{
c.selections_write_only() = SelectionList(c.buffer(), std::move(new_sels));
c.selections().sort_and_merge_overlapping();
}
c.selections_write_only().set(std::move(new_sels), main);
}
else
{

View File

@ -0,0 +1 @@
:exec -itersel jj<ret>

View File

@ -0,0 +1,3 @@
line %(1)
%(l)ine 2
line 3

View File

@ -0,0 +1 @@
l:3