diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2012-02-27 19:52:36 +0000 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2012-02-27 19:52:36 +0000 |
| commit | 5bddd166f10895635e0c2666c3fea5807aaf3302 (patch) | |
| tree | 4892dae392a19d3c16208cf5e3bd2be0619c03a0 /src/buffer.cc | |
| parent | c03506ca0472891f9727e1777746bf6c85d80fd0 (diff) | |
fix Buffer::line_length for last line
Diffstat (limited to 'src/buffer.cc')
| -rw-r--r-- | src/buffer.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/buffer.cc b/src/buffer.cc index 8f22d1f4..1866009f 100644 --- a/src/buffer.cc +++ b/src/buffer.cc @@ -75,8 +75,8 @@ BufferPos Buffer::line_at(const BufferIterator& iterator) const BufferSize Buffer::line_length(BufferPos line) const { assert(not m_lines.empty()); - BufferPos end = (line >= line_count() - 1) ? - m_content.size() : m_lines[line + 1] - 1; + BufferPos end = (line < m_lines.size() - 1) ? + m_lines[line + 1] - 1 : m_content.size(); return end - m_lines[line]; } |
