specialize BufferIterator::operator--

This commit is contained in:
Maxime Coste 2012-03-31 15:21:14 +00:00
parent f63320b19e
commit 07e1fcf67b

View File

@ -202,11 +202,22 @@ inline BufferIterator& BufferIterator::operator++()
++m_coord.line; ++m_coord.line;
m_coord.column = 0; m_coord.column = 0;
} }
return *this;
} }
inline BufferIterator& BufferIterator::operator--() inline BufferIterator& BufferIterator::operator--()
{ {
return (*this -= 1); if (column() == 0)
{
if (line() > 0)
{
--m_coord.line;
m_coord.column = m_buffer->m_lines[m_coord.line].length() - 1;
}
}
else
--m_coord.column;
return *this;
} }
inline bool BufferIterator::is_begin() const inline bool BufferIterator::is_begin() const