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/buffer.hh | |
| parent | fe988868e576b9b7fe047a7465d1b1f6867bf786 (diff) | |
Go back to a generic BufferChangeListener interface for selection update
Diffstat (limited to 'src/buffer.hh')
| -rw-r--r-- | src/buffer.hh | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/buffer.hh b/src/buffer.hh index 5fcf5811..4a1b3dcd 100644 --- a/src/buffer.hh +++ b/src/buffer.hh @@ -71,6 +71,7 @@ public: void on_erase(const BufferCoord& begin, const BufferCoord& end); const Buffer& buffer() const; + const BufferCoord& coord() const { return m_coord; } BufferSize line() const { return m_coord.line; } BufferSize column() const { return m_coord.column; } @@ -100,6 +101,13 @@ struct Modification static Modification make_insert(BufferIterator position, String content); }; +class BufferChangeListener +{ +public: + virtual void on_insert(const BufferIterator& begin, const BufferIterator& end) = 0; + virtual void on_erase(const BufferIterator& begin, const BufferIterator& end) = 0; +}; + // A Buffer is a in-memory representation of a file // // The Buffer class permits to read and mutate this file @@ -157,8 +165,8 @@ public: // notify the buffer that it was saved in the current state void notify_saved(); - void add_iterator_to_update(BufferIterator& iterator); - void remove_iterator_from_update(BufferIterator& iterator); + void add_change_listener(BufferChangeListener& listener); + void remove_change_listener(BufferChangeListener& listener); // returns an iterator pointing to the first character of the line // iterator is on @@ -210,7 +218,7 @@ private: size_t m_last_save_undo_index; - std::vector<BufferIterator*> m_iterators_to_update; + std::vector<BufferChangeListener*> m_change_listeners; OptionManager m_option_manager; HookManager m_hook_manager; |
