diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2012-10-11 00:41:48 +0200 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2012-10-11 00:41:48 +0200 |
| commit | 0ce6bd9bf54332d9eed8c7462ab4dfe08f8fac95 (patch) | |
| tree | 662591856f7227e3fb8592d582edaf2766a3f3e6 /src/buffer_iterator.inl.hh | |
| parent | 571861bc7bbe10bf831b861f7e6e0a2aa0a40839 (diff) | |
use ByteCount instead of CharCount when we are really counting bytes
(that is most of the time when we are not concerned with displaying)
Diffstat (limited to 'src/buffer_iterator.inl.hh')
| -rw-r--r-- | src/buffer_iterator.inl.hh | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/buffer_iterator.inl.hh b/src/buffer_iterator.inl.hh index 0738263a..950b7dfb 100644 --- a/src/buffer_iterator.inl.hh +++ b/src/buffer_iterator.inl.hh @@ -114,7 +114,7 @@ inline char BufferIterator::operator*() const return m_buffer->m_lines[line()].content[column()]; } -inline CharCount BufferIterator::offset() const +inline ByteCount BufferIterator::offset() const { assert(m_buffer); return line() == 0 ? column() @@ -127,12 +127,12 @@ inline size_t BufferIterator::operator-(const BufferIterator& iterator) const return (size_t)(int)(offset() - iterator.offset()); } -inline BufferIterator BufferIterator::operator+(CharCount size) const +inline BufferIterator BufferIterator::operator+(ByteCount size) const { assert(m_buffer); if (size >= 0) { - CharCount o = std::min(m_buffer->character_count(), offset() + size); + ByteCount o = std::min(m_buffer->character_count(), offset() + size); for (LineCount i = line() + 1; i < m_buffer->line_count(); ++i) { if (m_buffer->m_lines[i].start > o) @@ -144,12 +144,12 @@ inline BufferIterator BufferIterator::operator+(CharCount size) const return operator-(-size); } -inline BufferIterator BufferIterator::operator-(CharCount size) const +inline BufferIterator BufferIterator::operator-(ByteCount size) const { assert(m_buffer); if (size >= 0) { - CharCount o = std::max(0_char, offset() - size); + ByteCount o = std::max(0_byte, offset() - size); for (LineCount i = line(); i >= 0; --i) { if (m_buffer->m_lines[i].start <= o) @@ -160,12 +160,12 @@ inline BufferIterator BufferIterator::operator-(CharCount size) const return operator+(-size); } -inline BufferIterator& BufferIterator::operator+=(CharCount size) +inline BufferIterator& BufferIterator::operator+=(ByteCount size) { return *this = (*this + size); } -inline BufferIterator& BufferIterator::operator-=(CharCount size) +inline BufferIterator& BufferIterator::operator-=(ByteCount size) { return *this = (*this - size); } |
