diff --git a/src/gui/BufferPane.cc b/src/gui/BufferPane.cc index 29fa4d8..831b7fd 100644 --- a/src/gui/BufferPane.cc +++ b/src/gui/BufferPane.cc @@ -12,7 +12,7 @@ void BufferPane::resize(int width, int height) { Pane::resize(width, height); m_columns = std::max(1, m_width / m_window->font()->get_advance()); - m_rows = std::max(1, (m_height + m_window->font()->get_line_height() - 1) / m_window->font()->get_line_height()); + m_rows = std::max(1, m_height / m_window->font()->get_line_height()); } void BufferPane::walk_line(const Buffer::Iterator & start_of_line, std::function callback) @@ -165,7 +165,7 @@ void BufferPane::draw() break; } } - while (screen_row < m_rows) + while (screen_row <= m_rows) { screen_row += draw_buffer_line(screen_row, i); if (!i.go_next_line()) @@ -188,7 +188,7 @@ int BufferPane::draw_buffer_line(int screen_row, const Buffer::Iterator & start_ int draw_row = screen_row + row_offset; int x = col_x(screen_column); int y = row_y(draw_row); - if ((draw_row >= 0) && (draw_row < m_rows)) + if ((draw_row >= 0) && (draw_row <= m_rows)) { if (i == *m_iterator) {