add temporary buffer drawing with gap buffer before GUI code refactoring

This commit is contained in:
Josh Holtrop 2016-11-25 08:57:46 -05:00
parent 1e2aae4136
commit 1e40243664

View File

@ -401,7 +401,24 @@ void Window::draw_buffer()
void Window::draw_buffer_line(int screen_row, const GapBuffer::Cursor & cursor)
{
/* TODO */
GapBuffer::Cursor iter_cursor = cursor;
while (!iter_cursor.is_end_of_line(false))
{
int draw_row = screen_row + (iter_cursor.column() / m_columns);
if (draw_row < 0)
continue;
if (draw_row >= m_rows)
break;
int draw_column = iter_cursor.column() % m_columns;
int x, y;
colrow_to_xy(draw_column, draw_row, &x, &y);
uint32_t c = *iter_cursor;
if ((c != '\t') && (c != ' '))
{
draw_character(x, y, c);
}
iter_cursor.go_right(false);
}
}
void Window::draw_buffer_character(int screen_column, int screen_row, uint32_t character)