Terminal: Constrain the cursor inside the terminal rect.

This commit is contained in:
Andreas Kling 2019-02-03 04:04:42 +01:00
parent 333aa1646c
commit db2422d0d3

View file

@ -407,8 +407,10 @@ void Terminal::scroll_up()
set_cursor(new_row, 0);
}
void Terminal::set_cursor(unsigned row, unsigned column)
void Terminal::set_cursor(unsigned a_row, unsigned a_column)
{
unsigned row = min(a_row, m_rows - 1u);
unsigned column = min(a_column, m_columns - 1u);
if (row == m_cursor_row && column == m_cursor_column)
return;
ASSERT(row < rows());