mirror of
https://github.com/mawww/kakoune.git
synced 2024-12-18 17:02:06 +03:00
Fix last line handling in buffer
This commit is contained in:
parent
a386315bde
commit
416a1805b3
@ -121,7 +121,10 @@ BufferSize Buffer::length() const
|
||||
|
||||
BufferSize Buffer::line_count() const
|
||||
{
|
||||
return m_lines.size();
|
||||
if (m_lines.back() == m_content.size())
|
||||
return m_lines.size() - 1;
|
||||
else
|
||||
return m_lines.size();
|
||||
}
|
||||
|
||||
BufferString Buffer::string(const BufferIterator& begin, const BufferIterator& end) const
|
||||
@ -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