mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:17:35 +00: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);
|
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)
|
if (row == m_cursor_row && column == m_cursor_column)
|
||||||
return;
|
return;
|
||||||
ASSERT(row < rows());
|
ASSERT(row < rows());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue