diff options
author | Andreas Kling <kling@serenityos.org> | 2020-01-25 19:52:35 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-01-25 19:52:35 +0100 |
commit | ab77bd4c3aabaa8f114c3fbdf955544fa04bd054 (patch) | |
tree | 0ca471ca1016328a8f104a58baaa4a286c61bfb3 /Libraries/LibVT | |
parent | 25f04b06ad8e756460e908974ff2b9ff36905966 (diff) | |
download | serenity-ab77bd4c3aabaa8f114c3fbdf955544fa04bd054.zip |
LibVT: Support <esc>#8 to fill screen with E's
This is apparently a "confidence test" supported by VT100.
Diffstat (limited to 'Libraries/LibVT')
-rw-r--r-- | Libraries/LibVT/Terminal.cpp | 33 | ||||
-rw-r--r-- | Libraries/LibVT/Terminal.h | 3 |
2 files changed, 31 insertions, 5 deletions
diff --git a/Libraries/LibVT/Terminal.cpp b/Libraries/LibVT/Terminal.cpp index 8da29d730c..a8e8d4f7a3 100644 --- a/Libraries/LibVT/Terminal.cpp +++ b/Libraries/LibVT/Terminal.cpp @@ -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 << "'"; + } +} + } diff --git a/Libraries/LibVT/Terminal.h b/Libraries/LibVT/Terminal.h index 1c6bf482a0..85f960e38b 100644 --- a/Libraries/LibVT/Terminal.h +++ b/Libraries/LibVT/Terminal.h @@ -195,6 +195,7 @@ private: void execute_escape_sequence(u8 final); void execute_xterm_command(); + void execute_hashtag(u8); enum EscapeState { Normal, @@ -202,7 +203,7 @@ private: ExpectParameter, ExpectIntermediate, ExpectFinal, - + ExpectHashtagDigit, ExpectXtermParameter1, ExpectXtermParameter2, ExpectXtermFinal, |