1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-18 17:02:06 +03:00

fix update_lines on empty buffer

This commit is contained in:
Maxime Coste 2012-03-12 14:26:46 +00:00
parent cd615b35a2
commit 97b8905a6d

View File

@ -214,7 +214,8 @@ void Buffer::update_lines(const Modification& modification)
std::vector<BufferPos> new_lines;
// if we inserted at the end of the buffer, we may have created a new
// line without inserting a '\n'
if (endpos == m_content.size() and pos > 0 and m_content[pos-1] == '\n')
if (endpos == m_content.size() and
(pos == 0 or m_content[pos-1] == '\n'))
new_lines.push_back(pos);
// every \n inserted that was not the last buffer character created a