fix number_lines line count computing

This commit is contained in:
Maxime Coste 2012-02-27 14:24:14 +00:00
parent 7f175da3fd
commit b6b66aecc9

View File

@ -143,7 +143,7 @@ void show_line_numbers(DisplayBuffer& display_buffer)
const Buffer& buffer = display_buffer.front().begin().buffer();
BufferCoord coord = buffer.line_and_column_at(display_buffer.begin()->begin());
int last_line = buffer.line_count()-1;
int last_line = buffer.line_count();
int digit_count = 0;
for (int c = last_line; c > 0; c /= 10)
++digit_count;
@ -151,7 +151,7 @@ void show_line_numbers(DisplayBuffer& display_buffer)
char format[] = "%?d ";
format[1] = '0' + digit_count;
for (; coord.line <= last_line; ++coord.line)
for (; coord.line <= last_line-1; ++coord.line)
{
BufferIterator line_start = buffer.iterator_at(coord);
DisplayBuffer::iterator atom_it = display_buffer.atom_containing(line_start);