diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2012-03-12 14:26:46 +0000 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2012-03-12 14:26:46 +0000 |
| commit | 97b8905a6de553d0905f40cb2d2c2bfcd341bdb7 (patch) | |
| tree | d6927c7f724a54afc3641d9a37e213902f844f1f /src/buffer.cc | |
| parent | cd615b35a2a3b4e71d5f6232e307a8c4c07f834a (diff) | |
fix update_lines on empty buffer
Diffstat (limited to 'src/buffer.cc')
| -rw-r--r-- | src/buffer.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/buffer.cc b/src/buffer.cc index d4a5b882..707981b8 100644 --- a/src/buffer.cc +++ b/src/buffer.cc @@ -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 |
