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:
parent
36e7e93f78
commit
9b89652b0b
|
@ -1662,16 +1662,16 @@ void context_wrap(const ParametersParser& parser, Context& context, Func func)
|
||||||
|
|
||||||
update_selections(new_sels, main, c.buffer(), timestamp);
|
update_selections(new_sels, main, c.buffer(), timestamp);
|
||||||
timestamp = c.buffer().timestamp();
|
timestamp = c.buffer().timestamp();
|
||||||
|
if (&sel == &sels.main())
|
||||||
|
main = new_sels.size() + c.selections().main_index();
|
||||||
|
|
||||||
for (auto& sel : c.selections())
|
for (auto& sel : c.selections())
|
||||||
new_sels.push_back(sel);
|
new_sels.push_back(sel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (not draft)
|
if (not draft)
|
||||||
{
|
c.selections_write_only().set(std::move(new_sels), main);
|
||||||
c.selections_write_only() = SelectionList(c.buffer(), std::move(new_sels));
|
|
||||||
c.selections().sort_and_merge_overlapping();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
1
test/regression/0-assert-on-itersel/cmd
Normal file
1
test/regression/0-assert-on-itersel/cmd
Normal file
|
@ -0,0 +1 @@
|
||||||
|
:exec -itersel jj<ret>
|
3
test/regression/0-assert-on-itersel/in
Normal file
3
test/regression/0-assert-on-itersel/in
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
line %(1)
|
||||||
|
%(l)ine 2
|
||||||
|
line 3
|
1
test/regression/0-assert-on-itersel/selections
Normal file
1
test/regression/0-assert-on-itersel/selections
Normal file
|
@ -0,0 +1 @@
|
||||||
|
l:3
|
Loading…
Reference in New Issue
Block a user