diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2012-03-30 12:01:18 +0000 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2012-03-30 12:01:18 +0000 |
| commit | 45e362d213ab4de8f5e08325a8a299468d316fe7 (patch) | |
| tree | 1ca760b24f9e6944ab139159d3bcf8363b9634ee /src/buffer_iterator.inl.hh | |
| parent | 2e7cd2233ce449a51756c180432635eb1aee20f3 (diff) | |
specialize BufferIterator::operator++ to speed up Kakoune
Diffstat (limited to 'src/buffer_iterator.inl.hh')
| -rw-r--r-- | src/buffer_iterator.inl.hh | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/buffer_iterator.inl.hh b/src/buffer_iterator.inl.hh index 1ad3e25f..034310b1 100644 --- a/src/buffer_iterator.inl.hh +++ b/src/buffer_iterator.inl.hh @@ -193,7 +193,15 @@ inline BufferIterator& BufferIterator::operator-=(BufferSize size) 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--() |
