diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2012-08-15 18:20:02 +0200 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2012-08-15 18:20:02 +0200 |
| commit | a2aefa299874437a87e3ff0aec8f71d7a490408a (patch) | |
| tree | 5fb08bdeb86c04f145ba4ee615a4a0c8d64bbe73 /src | |
| parent | 416785f53c1af30b7c4fbc1a9a22df046b90f009 (diff) | |
avoid keeping end of lines selected in Editor::erase
Diffstat (limited to 'src')
| -rw-r--r-- | src/editor.cc | 5 | ||||
| -rw-r--r-- | src/selection.cc | 6 | ||||
| -rw-r--r-- | src/selection.hh | 1 |
3 files changed, 11 insertions, 1 deletions
diff --git a/src/editor.cc b/src/editor.cc index b262698b..06f47149 100644 --- a/src/editor.cc +++ b/src/editor.cc @@ -21,8 +21,11 @@ Editor::Editor(Buffer& buffer) void Editor::erase() { scoped_edition edition(*this); - for (auto& sel : selections()) + for (auto& sel : m_selections.back()) + { m_buffer.erase(sel.begin(), sel.end()); + sel.avoid_eol(); + } } template<bool append> diff --git a/src/selection.cc b/src/selection.cc index a892e9fc..6f483dc6 100644 --- a/src/selection.cc +++ b/src/selection.cc @@ -54,6 +54,12 @@ void Selection::merge_with(const Selection& selection) 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) { m_first.on_insert(begin.coord(), end.coord()); diff --git a/src/selection.hh b/src/selection.hh index 29a008a2..7081e427 100644 --- a/src/selection.hh +++ b/src/selection.hh @@ -29,6 +29,7 @@ struct Selection : public BufferChangeListener const BufferIterator& last() const { return m_last; } void merge_with(const Selection& selection); + void avoid_eol(); void on_insert(const BufferIterator& begin, const BufferIterator& end); void on_erase(const BufferIterator& begin, const BufferIterator& end); |
