mirror of
https://github.com/mawww/kakoune.git
synced 2024-12-29 14:44:56 +03:00
Fix modified range computation when erasing multiple times past current buffer end
Fixes #654
This commit is contained in:
parent
7521165011
commit
b0060ed79e
@ -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());
|
||||
|
1
test/regression/654-crash-on-undo-after-macro/cmd
Normal file
1
test/regression/654-crash-on-undo-after-macro/cmd
Normal file
@ -0,0 +1 @@
|
||||
Qxy<a-p>;dQ3qu
|
1
test/regression/654-crash-on-undo-after-macro/in
Normal file
1
test/regression/654-crash-on-undo-after-macro/in
Normal file
@ -0,0 +1 @@
|
||||
aaa
|
1
test/regression/654-crash-on-undo-after-macro/out
Normal file
1
test/regression/654-crash-on-undo-after-macro/out
Normal file
@ -0,0 +1 @@
|
||||
aaa
|
Loading…
Reference in New Issue
Block a user