avoid keeping end of lines selected in Editor::erase
This commit is contained in:
parent
416785f53c
commit
a2aefa2998
|
@ -21,8 +21,11 @@ Editor::Editor(Buffer& buffer)
|
||||||
void Editor::erase()
|
void Editor::erase()
|
||||||
{
|
{
|
||||||
scoped_edition edition(*this);
|
scoped_edition edition(*this);
|
||||||
for (auto& sel : selections())
|
for (auto& sel : m_selections.back())
|
||||||
|
{
|
||||||
m_buffer.erase(sel.begin(), sel.end());
|
m_buffer.erase(sel.begin(), sel.end());
|
||||||
|
sel.avoid_eol();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<bool append>
|
template<bool append>
|
||||||
|
|
|
@ -54,6 +54,12 @@ void Selection::merge_with(const Selection& selection)
|
||||||
m_last = selection.m_last;
|
m_last = selection.m_last;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Selection::avoid_eol()
|
||||||
|
{
|
||||||
|
m_first.clamp(true);
|
||||||
|
m_last.clamp(true);
|
||||||
|
}
|
||||||
|
|
||||||
void Selection::on_insert(const BufferIterator& begin, const BufferIterator& end)
|
void Selection::on_insert(const BufferIterator& begin, const BufferIterator& end)
|
||||||
{
|
{
|
||||||
m_first.on_insert(begin.coord(), end.coord());
|
m_first.on_insert(begin.coord(), end.coord());
|
||||||
|
|
|
@ -29,6 +29,7 @@ struct Selection : public BufferChangeListener
|
||||||
const BufferIterator& last() const { return m_last; }
|
const BufferIterator& last() const { return m_last; }
|
||||||
|
|
||||||
void merge_with(const Selection& selection);
|
void merge_with(const Selection& selection);
|
||||||
|
void avoid_eol();
|
||||||
|
|
||||||
void on_insert(const BufferIterator& begin, const BufferIterator& end);
|
void on_insert(const BufferIterator& begin, const BufferIterator& end);
|
||||||
void on_erase(const BufferIterator& begin, const BufferIterator& end);
|
void on_erase(const BufferIterator& begin, const BufferIterator& end);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user