parent
8c05d9e146
commit
13ed87410f
|
@ -65,7 +65,8 @@ ByteCoord update_erase(ByteCoord coord, ByteCoord begin, ByteCoord end)
|
|||
|
||||
bool compare_selections(const Selection& lhs, const Selection& rhs)
|
||||
{
|
||||
return lhs.min() < rhs.min();
|
||||
const auto lmin = lhs.min(), rmin = rhs.min();
|
||||
return lmin == rmin ? lhs.max() < rhs.max() : lmin < rmin;
|
||||
}
|
||||
|
||||
template<typename Iterator, typename OverlapsFunc>
|
||||
|
@ -305,17 +306,15 @@ 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());
|
||||
}
|
||||
|
||||
const auto end_coord = buffer.end_coord();
|
||||
for (auto& range : ranges)
|
||||
{
|
||||
range.anchor() = std::min(range.anchor(), end_coord);
|
||||
range.cursor() = std::min<ByteCoord>(range.cursor(), end_coord);
|
||||
}
|
||||
|
||||
auto touches = [&](const Selection& lhs, const Selection& rhs) {
|
||||
|
@ -326,6 +325,9 @@ Vector<Selection> compute_modified_ranges(Buffer& buffer, size_t timestamp)
|
|||
|
||||
for (auto& sel : ranges)
|
||||
{
|
||||
kak_assert(buffer.is_valid(sel.anchor()));
|
||||
kak_assert(buffer.is_valid(sel.cursor()));
|
||||
|
||||
if (buffer.is_end(sel.anchor()))
|
||||
sel.anchor() = buffer.back_coord();
|
||||
if (buffer.is_end(sel.cursor()))
|
||||
|
|
1
test/compose/undo-multi-replace-at-end/cmd
Normal file
1
test/compose/undo-multi-replace-at-end/cmd
Normal file
|
@ -0,0 +1 @@
|
|||
%<a-s>y1<a-space>Ru
|
3
test/compose/undo-multi-replace-at-end/in
Normal file
3
test/compose/undo-multi-replace-at-end/in
Normal file
|
@ -0,0 +1,3 @@
|
|||
line 1
|
||||
line 2
|
||||
line 3
|
2
test/compose/undo-multi-replace-at-end/selections
Normal file
2
test/compose/undo-multi-replace-at-end/selections
Normal file
|
@ -0,0 +1,2 @@
|
|||
line 2
|
||||
line 3
|
1
test/regression/743-crash-on-replace-undo/cmd
Normal file
1
test/regression/743-crash-on-replace-undo/cmd
Normal file
|
@ -0,0 +1 @@
|
|||
%s1<ret>xyjRu
|
5
test/regression/743-crash-on-replace-undo/in
Normal file
5
test/regression/743-crash-on-replace-undo/in
Normal file
|
@ -0,0 +1,5 @@
|
|||
line 1
|
||||
line 2
|
||||
|
||||
line 1
|
||||
line 2
|
5
test/regression/743-crash-on-replace-undo/out
Normal file
5
test/regression/743-crash-on-replace-undo/out
Normal file
|
@ -0,0 +1,5 @@
|
|||
line 1
|
||||
line 2
|
||||
|
||||
line 1
|
||||
line 2
|
Loading…
Reference in New Issue
Block a user