diff options
author | Daniel Bertalan <dani@danielbertalan.dev> | 2021-06-09 21:50:44 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-06-10 17:18:02 +0200 |
commit | 3752775a1ec70ef96a1afc255e4b60bff8e7d31e (patch) | |
tree | 3c1d67d47b05d81c6c6f8e05d5b765bebb035181 | |
parent | a3c4397432c776fbf0b9e233882258980e30866e (diff) | |
download | serenity-3752775a1ec70ef96a1afc255e4b60bff8e7d31e.zip |
LibVT: Implement `DECIC`/`DECDC`
This commit adds support for these escape sequences that are used for
scrolling multiple lines at once. In the current, unoptimized
implementation, these just call the `scroll_left` and `scroll_right`
APIs multiple times.
It's a VT420 feature.
-rw-r--r-- | Userland/Libraries/LibVT/Terminal.cpp | 34 | ||||
-rw-r--r-- | Userland/Libraries/LibVT/Terminal.h | 6 |
2 files changed, 40 insertions, 0 deletions
diff --git a/Userland/Libraries/LibVT/Terminal.cpp b/Userland/Libraries/LibVT/Terminal.cpp index 4d04d34176..138ba4a3b8 100644 --- a/Userland/Libraries/LibVT/Terminal.cpp +++ b/Userland/Libraries/LibVT/Terminal.cpp @@ -907,6 +907,28 @@ void Terminal::DECBI() set_cursor(cursor_row(), cursor_column() - 1); } +void Terminal::DECIC(Parameters params) +{ + unsigned num = 1; + if (params.size() >= 1 && params[0] != 0) + num = params[0]; + + num = min<unsigned>(num, columns() - cursor_column()); + for (unsigned row = cursor_row(); row <= m_scroll_region_bottom; ++row) + scroll_right(row, cursor_column(), num); +} + +void Terminal::DECDC(Parameters params) +{ + unsigned num = 1; + if (params.size() >= 1 && params[0] != 0) + num = params[0]; + + num = min<unsigned>(num, columns() - cursor_column()); + for (unsigned row = cursor_row(); row <= m_scroll_region_bottom; ++row) + scroll_left(row, cursor_column(), num); +} + void Terminal::DSR(Parameters params) { if (params.size() == 1 && params[0] == 5) { @@ -1147,6 +1169,18 @@ void Terminal::execute_csi_sequence(Parameters parameters, Intermediates interme case 'u': SCORC(); break; + case '}': + if (intermediates.size() >= 1 && intermediates[0] == '\'') + DECIC(parameters); + else + unimplemented_csi_sequence(parameters, intermediates, last_byte); + break; + case '~': + if (intermediates.size() >= 1 && intermediates[0] == '\'') + DECDC(parameters); + else + unimplemented_csi_sequence(parameters, intermediates, last_byte); + break; default: unimplemented_csi_sequence(parameters, intermediates, last_byte); } diff --git a/Userland/Libraries/LibVT/Terminal.h b/Userland/Libraries/LibVT/Terminal.h index 160bf08e40..1f5f974041 100644 --- a/Userland/Libraries/LibVT/Terminal.h +++ b/Userland/Libraries/LibVT/Terminal.h @@ -359,6 +359,12 @@ protected: // FIXME: Find the right names for these. void XTERM_WM(Parameters); + // DECIC - Insert Column + void DECIC(Parameters); + + // DECDC - Delete Column + void DECDC(Parameters); + #ifndef KERNEL TerminalClient& m_client; #else |