diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2012-07-16 21:51:37 +0200 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2012-07-16 21:51:37 +0200 |
| commit | 31c0931dffbbf100ddcf1f2f2edc0d830fec8f39 (patch) | |
| tree | a9543e8572a81bd170a631973b48896801dd2b73 /src/selection.cc | |
| parent | fe988868e576b9b7fe047a7465d1b1f6867bf786 (diff) | |
Go back to a generic BufferChangeListener interface for selection update
Diffstat (limited to 'src/selection.cc')
| -rw-r--r-- | src/selection.cc | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/selection.cc b/src/selection.cc index 46a38e0f..a892e9fc 100644 --- a/src/selection.cc +++ b/src/selection.cc @@ -54,18 +54,28 @@ void Selection::merge_with(const Selection& selection) m_last = selection.m_last; } +void Selection::on_insert(const BufferIterator& begin, const BufferIterator& end) +{ + m_first.on_insert(begin.coord(), end.coord()); + m_last.on_insert(begin.coord(), end.coord()); +} + +void Selection::on_erase(const BufferIterator& begin, const BufferIterator& end) +{ + m_first.on_erase(begin.coord(), end.coord()); + m_last.on_erase(begin.coord(), end.coord()); +} + void Selection::register_with_buffer() { Buffer& buffer = const_cast<Buffer&>(m_first.buffer()); - buffer.add_iterator_to_update(m_first); - buffer.add_iterator_to_update(m_last); + buffer.add_change_listener(*this); } void Selection::unregister_with_buffer() { Buffer& buffer = const_cast<Buffer&>(m_first.buffer()); - buffer.remove_iterator_from_update(m_first); - buffer.remove_iterator_from_update(m_last); + buffer.remove_change_listener(*this); } } |
