diff --git a/src/gui/BufferPane.cc b/src/gui/BufferPane.cc index eb93fdc..aaa29ea 100644 --- a/src/gui/BufferPane.cc +++ b/src/gui/BufferPane.cc @@ -307,28 +307,23 @@ void BufferPane::draw() int BufferPane::draw_buffer_line(int screen_row, const Buffer::Iterator & start_of_line) { int saved_row_offset = 0; - walk_line(start_of_line, [this, &saved_row_offset, &screen_row](int row_offset, int screen_column, int virtual_column, int character_width, const Buffer::Iterator & i) { + int last_drawn_crosshair_row = -1; + walk_line(start_of_line, [this, &saved_row_offset, &screen_row, &last_drawn_crosshair_row](int row_offset, int screen_column, int virtual_column, int character_width, const Buffer::Iterator & i) { uint32_t code_point = *i; int draw_row = screen_row + row_offset; if ((draw_row >= 0) && (draw_row <= m_rows)) { if (i.line() == m_iterator->line()) { - int row = draw_row; - int col = screen_column; - int c_w = character_width; - if (insert_mode() && (code_point == '\n')) + if ((code_point != '\n') && (code_point != Buffer::Iterator::INVALID_CODE_POINT)) { - c_w = 1; - } - for (int i = 0; i < c_w; i++) - { - draw_crosshair(col_x(col), row_y(row)); - col++; - if (col >= m_columns) + if (draw_row > last_drawn_crosshair_row) { - row++; - col = 0; + for (int col = screen_column; col < m_columns; col++) + { + draw_crosshair(col_x(col), row_y(draw_row)); + } + last_drawn_crosshair_row = draw_row; } } }