Add BufferIterator::clamp(bool avoid_eol) method

This commit is contained in:
Maxime Coste 2012-08-15 18:18:12 +02:00
parent 390d4ccdfc
commit 416785f53c
2 changed files with 8 additions and 0 deletions

View File

@ -61,6 +61,8 @@ public:
BufferIterator& operator++ (); BufferIterator& operator++ ();
BufferIterator& operator-- (); BufferIterator& operator-- ();
void clamp(bool avoid_eol);
bool is_begin() const; bool is_begin() const;
bool is_end() const; bool is_end() const;
bool is_valid() const; bool is_valid() const;

View File

@ -28,6 +28,12 @@ inline bool BufferIterator::is_valid() const
column() == m_buffer->m_lines.back().length())); 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 inline bool BufferIterator::operator==(const BufferIterator& iterator) const
{ {
assert(m_buffer == iterator.m_buffer); assert(m_buffer == iterator.m_buffer);