Draw crosshair for the current line to the end of the screen row

This commit is contained in:
Josh Holtrop 2017-01-24 22:09:10 -05:00
parent 210a7b82c5
commit 9a34bfe4ba

View File

@ -307,28 +307,23 @@ void BufferPane::draw()
int BufferPane::draw_buffer_line(int screen_row, const Buffer::Iterator & start_of_line) int BufferPane::draw_buffer_line(int screen_row, const Buffer::Iterator & start_of_line)
{ {
int saved_row_offset = 0; 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; uint32_t code_point = *i;
int draw_row = screen_row + row_offset; int draw_row = screen_row + row_offset;
if ((draw_row >= 0) && (draw_row <= m_rows)) if ((draw_row >= 0) && (draw_row <= m_rows))
{ {
if (i.line() == m_iterator->line()) if (i.line() == m_iterator->line())
{ {
int row = draw_row; if ((code_point != '\n') && (code_point != Buffer::Iterator::INVALID_CODE_POINT))
int col = screen_column;
int c_w = character_width;
if (insert_mode() && (code_point == '\n'))
{ {
c_w = 1; if (draw_row > last_drawn_crosshair_row)
}
for (int i = 0; i < c_w; i++)
{
draw_crosshair(col_x(col), row_y(row));
col++;
if (col >= m_columns)
{ {
row++; for (int col = screen_column; col < m_columns; col++)
col = 0; {
draw_crosshair(col_x(col), row_y(draw_row));
}
last_drawn_crosshair_row = draw_row;
} }
} }
} }