Fix modified range computation when erasing multiple times past current buffer end

Fixes #654
This commit is contained in:
Maxime Coste 2016-04-13 20:48:34 +01:00
parent 7521165011
commit b0060ed79e
4 changed files with 11 additions and 0 deletions

View File

@ -305,6 +305,14 @@ Vector<Selection> compute_modified_ranges(Buffer& buffer, size_t timestamp)
change_it = backward_end;
}
const auto end_coord = buffer.end_coord();
for (auto it = ranges.begin() + prev_size; it != ranges.end(); ++it)
{
it->anchor() = std::min(it->anchor(), end_coord);
it->cursor() = std::min<ByteCoord>(it->cursor(), end_coord);
}
kak_assert(std::is_sorted(ranges.begin() + prev_size, ranges.end(), compare_selections));
std::inplace_merge(ranges.begin(), ranges.begin() + prev_size, ranges.end(), compare_selections);
ranges.erase(merge_overlapping(ranges.begin(), ranges.end(), dummy, overlaps), ranges.end());

View File

@ -0,0 +1 @@
Qxy<a-p>;dQ3qu

View File

@ -0,0 +1 @@
aaa

View File

@ -0,0 +1 @@
aaa