Merge overlapping selections before erasing
Overlapping selections on erase confuse the ForwardChangeTracker and will confuse the user, Fixes #298
This commit is contained in:
parent
373ad05f29
commit
8795a56731
|
@ -508,6 +508,10 @@ void SelectionList::insert(ConstArrayView<String> strings, InsertMode mode,
|
||||||
void SelectionList::erase()
|
void SelectionList::erase()
|
||||||
{
|
{
|
||||||
update();
|
update();
|
||||||
|
|
||||||
|
m_selections.erase(merge_overlapping(begin(), end(), m_main, overlaps),
|
||||||
|
end());
|
||||||
|
|
||||||
ForwardChangesTracker changes_tracker;
|
ForwardChangesTracker changes_tracker;
|
||||||
for (auto& sel : m_selections)
|
for (auto& sel : m_selections)
|
||||||
{
|
{
|
||||||
|
@ -529,6 +533,7 @@ void SelectionList::erase()
|
||||||
if (sel.cursor() > back_coord)
|
if (sel.cursor() > back_coord)
|
||||||
sel.cursor() = back_coord;
|
sel.cursor() = back_coord;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_buffer->check_invariant();
|
m_buffer->check_invariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
1
test/compose/del-empty-line/cmd
Normal file
1
test/compose/del-empty-line/cmd
Normal file
|
@ -0,0 +1 @@
|
||||||
|
CCdd
|
3
test/compose/del-empty-line/in
Normal file
3
test/compose/del-empty-line/in
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
asdf
|
||||||
|
|
||||||
|
asdf
|
2
test/compose/del-empty-line/out
Normal file
2
test/compose/del-empty-line/out
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
df
|
||||||
|
df
|
Loading…
Reference in New Issue
Block a user