mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 10:22:05 -05:00
Terminal: Constrain the cursor inside the terminal rect.
This commit is contained in:
parent
333aa1646c
commit
db2422d0d3
1 changed files with 3 additions and 1 deletions
|
@ -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());
|
||||
|
|
Loading…
Add table
Reference in a new issue