Buffer: rename character_count method to byte_count
This commit is contained in:
parent
7c4e79ef98
commit
f8c3b6c9ef
|
@ -96,7 +96,7 @@ ByteCount Buffer::line_length(LineCount line) const
|
||||||
{
|
{
|
||||||
kak_assert(line < line_count());
|
kak_assert(line < line_count());
|
||||||
ByteCount end = (line < line_count() - 1) ?
|
ByteCount end = (line < line_count() - 1) ?
|
||||||
m_lines[line + 1].start : character_count();
|
m_lines[line + 1].start : byte_count();
|
||||||
return end - m_lines[line].start;
|
return end - m_lines[line].start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ BufferIterator Buffer::end() const
|
||||||
return BufferIterator(*this, { line_count()-1, m_lines.back().length() });
|
return BufferIterator(*this, { line_count()-1, m_lines.back().length() });
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteCount Buffer::character_count() const
|
ByteCount Buffer::byte_count() const
|
||||||
{
|
{
|
||||||
if (m_lines.empty())
|
if (m_lines.empty())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -127,7 +127,7 @@ public:
|
||||||
|
|
||||||
BufferIterator begin() const;
|
BufferIterator begin() const;
|
||||||
BufferIterator end() const;
|
BufferIterator end() const;
|
||||||
ByteCount character_count() const;
|
ByteCount byte_count() const;
|
||||||
LineCount line_count() const;
|
LineCount line_count() const;
|
||||||
ByteCount line_length(LineCount line) const;
|
ByteCount line_length(LineCount line) const;
|
||||||
const String& line_content(LineCount line) const
|
const String& line_content(LineCount line) const
|
||||||
|
|
|
@ -72,7 +72,7 @@ inline ByteCount BufferIterator::offset() const
|
||||||
{
|
{
|
||||||
kak_assert(m_buffer);
|
kak_assert(m_buffer);
|
||||||
return line() >= m_buffer->line_count() ?
|
return line() >= m_buffer->line_count() ?
|
||||||
m_buffer->character_count() : m_buffer->m_lines[line()].start + column();
|
m_buffer->byte_count() : m_buffer->m_lines[line()].start + column();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t BufferIterator::operator-(const BufferIterator& iterator) const
|
inline size_t BufferIterator::operator-(const BufferIterator& iterator) const
|
||||||
|
@ -86,7 +86,7 @@ inline BufferIterator BufferIterator::operator+(ByteCount size) const
|
||||||
kak_assert(m_buffer);
|
kak_assert(m_buffer);
|
||||||
if (size >= 0)
|
if (size >= 0)
|
||||||
{
|
{
|
||||||
ByteCount o = std::min(m_buffer->character_count(), offset() + size);
|
ByteCount o = std::min(m_buffer->byte_count(), offset() + size);
|
||||||
for (LineCount i = line() + 1; i < m_buffer->line_count(); ++i)
|
for (LineCount i = line() + 1; i < m_buffer->line_count(); ++i)
|
||||||
{
|
{
|
||||||
if (m_buffer->m_lines[i].start > o)
|
if (m_buffer->m_lines[i].start > o)
|
||||||
|
@ -188,7 +188,7 @@ inline bool BufferIterator::is_end() const
|
||||||
kak_assert(m_coord.column == 0);
|
kak_assert(m_coord.column == 0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return offset() == m_buffer->character_count();
|
return offset() == m_buffer->byte_count();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user