specialize BufferIterator::operator++ to speed up Kakoune

This commit is contained in:
Maxime Coste 2012-03-30 12:01:18 +00:00
parent 2e7cd2233c
commit 45e362d213

View File

@ -193,7 +193,15 @@ inline BufferIterator& BufferIterator::operator-=(BufferSize size)
inline BufferIterator& BufferIterator::operator++() inline BufferIterator& BufferIterator::operator++()
{ {
return (*this += 1); if (column() < m_buffer->m_lines[line()].length() - 1)
++m_coord.column;
else if (line() == m_buffer->line_count() - 1)
m_coord.column = m_buffer->m_lines.back().length();
else
{
++m_coord.line;
m_coord.column = 0;
}
} }
inline BufferIterator& BufferIterator::operator--() inline BufferIterator& BufferIterator::operator--()