diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2012-04-04 13:56:19 +0000 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2012-04-04 13:56:19 +0000 |
| commit | e4b872abd26405a7c26ffbd14dff91c816750601 (patch) | |
| tree | 97832ec7afbbcf90280d1e68d67c3a057e5a11de /src/selection.cc | |
| parent | 6cedff8fb26dfd3fe099e71c3d96f8c62f48c73a (diff) | |
remove ModificationListener and use a list of iterators to update instead
This permits to fix a bug in BufferIterator::upgrade, replaced by
BufferIterator::on_insert and BufferIterator::on_erase. ModificationListener
was only used to updating iterators anyway.
Diffstat (limited to 'src/selection.cc')
| -rw-r--r-- | src/selection.cc | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/selection.cc b/src/selection.cc index c34c1362..46a38e0f 100644 --- a/src/selection.cc +++ b/src/selection.cc @@ -54,20 +54,18 @@ void Selection::merge_with(const Selection& selection) m_last = selection.m_last; } -void Selection::on_modification(const Modification& modification) -{ - m_first.update(modification); - m_last.update(modification); -} - void Selection::register_with_buffer() { - const_cast<Buffer&>(m_first.buffer()).register_modification_listener(this); + Buffer& buffer = const_cast<Buffer&>(m_first.buffer()); + buffer.add_iterator_to_update(m_first); + buffer.add_iterator_to_update(m_last); } void Selection::unregister_with_buffer() { - const_cast<Buffer&>(m_first.buffer()).unregister_modification_listener(this); + Buffer& buffer = const_cast<Buffer&>(m_first.buffer()); + buffer.remove_iterator_from_update(m_first); + buffer.remove_iterator_from_update(m_last); } } |
