Fix last line handling in buffer
This commit is contained in:
parent
a386315bde
commit
416a1805b3
|
@ -121,6 +121,9 @@ BufferSize Buffer::length() const
|
|||
|
||||
BufferSize Buffer::line_count() const
|
||||
{
|
||||
if (m_lines.back() == m_content.size())
|
||||
return m_lines.size() - 1;
|
||||
else
|
||||
return m_lines.size();
|
||||
}
|
||||
|
||||
|
@ -191,7 +194,7 @@ void Buffer::compute_lines()
|
|||
{
|
||||
m_lines.clear();
|
||||
m_lines.push_back(0);
|
||||
for (BufferPos i = 0; i + 1 < m_content.size(); ++i)
|
||||
for (BufferPos i = 0; i < m_content.size(); ++i)
|
||||
{
|
||||
if (m_content[i] == '\n')
|
||||
m_lines.push_back(i + 1);
|
||||
|
|
Loading…
Reference in New Issue
Block a user