1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:28:12 +00:00

LibVT: Implement ICH sequence.

This commit is contained in:
Tyler Lanphear 2021-01-08 01:33:17 -05:00 committed by Andreas Kling
parent e575d3fd3d
commit 0f988424cf
2 changed files with 26 additions and 0 deletions

View file

@ -704,6 +704,9 @@ void Terminal::execute_escape_sequence(u8 final)
case 'n':
DSR(params);
break;
case '@':
ICH(params);
break;
default:
dbgprintf("Terminal::execute_escape_sequence: Unhandled final '%c'\n", final);
break;
@ -821,6 +824,28 @@ void Terminal::DSR(const ParamVector& params)
}
}
void Terminal::ICH(const ParamVector& params)
{
int num = 0;
if (params.size() >= 1) {
num = params[0];
}
if (num == 0)
num = 1;
auto& line = m_lines[m_cursor_row];
// Move characters after cursor to the right
for (int i = line.length() - num; i >= m_cursor_column; --i)
line.set_code_point(i + num, line.code_point(i));
// Fill n characters after cursor with blanks
for (int i = 0; i < num; i++)
line.set_code_point(m_cursor_column + i, ' ');
line.set_dirty(true);
}
void Terminal::on_input(u8 ch)
{
#ifdef TERMINAL_DEBUG