1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:07:34 +00:00

LibVT: Support <esc>#8 to fill screen with E's

This is apparently a "confidence test" supported by VT100.
This commit is contained in:
Andreas Kling 2020-01-25 19:52:35 +01:00
parent 25f04b06ad
commit ab77bd4c3a
2 changed files with 31 additions and 5 deletions

View file

@ -774,16 +774,25 @@ void Terminal::on_char(u8 ch)
#endif
switch (m_escape_state) {
case ExpectBracket:
if (ch == '[')
if (ch == '[') {
m_escape_state = ExpectParameter;
else if (ch == '(') {
} else if (ch == '(') {
m_swallow_current = true;
m_escape_state = ExpectParameter;
} else if (ch == ']')
} else if (ch == ']') {
m_escape_state = ExpectXtermParameter1;
else
} else if (ch == '#') {
m_escape_state = ExpectHashtagDigit;
} else {
m_escape_state = Normal;
}
return;
case ExpectHashtagDigit:
if (ch >= '0' && ch <= '9') {
execute_hashtag(ch);
m_escape_state = Normal;
}
break;
case ExpectXtermParameter1:
if (ch != ';') {
m_xterm_param1.append(ch);
@ -969,4 +978,20 @@ void Terminal::invalidate_cursor()
line(m_cursor_row).dirty = true;
}
void Terminal::execute_hashtag(u8 hashtag)
{
switch (hashtag) {
case '8':
// Confidence Test - Fill screen with E's
for (size_t row = 0; row < m_rows; ++row) {
for (size_t column = 0; column < m_columns; ++column) {
put_character_at(row, column, 'E');
}
}
break;
default:
dbg() << "Unknown hashtag: '" << hashtag << "'";
}
}
}