diff --git a/src/buffer.hh b/src/buffer.hh index a0d19836..0c57f851 100644 --- a/src/buffer.hh +++ b/src/buffer.hh @@ -61,6 +61,8 @@ public: BufferIterator& operator++ (); BufferIterator& operator-- (); + void clamp(bool avoid_eol); + bool is_begin() const; bool is_end() const; bool is_valid() const; diff --git a/src/buffer_iterator.inl.hh b/src/buffer_iterator.inl.hh index 56d7efa1..eb9d5bcb 100644 --- a/src/buffer_iterator.inl.hh +++ b/src/buffer_iterator.inl.hh @@ -28,6 +28,12 @@ inline bool BufferIterator::is_valid() const column() == m_buffer->m_lines.back().length())); } +inline void BufferIterator::clamp(bool avoid_eol) +{ + assert(m_buffer); + m_coord = m_buffer->clamp(m_coord, avoid_eol); +} + inline bool BufferIterator::operator==(const BufferIterator& iterator) const { assert(m_buffer == iterator.m_buffer);