diff options
author | Daniel Bertalan <dani@danielbertalan.dev> | 2021-06-02 15:36:31 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-06-10 17:18:02 +0200 |
commit | ae6bdc4e29a6e38d0305d620b2301de6328dde0e (patch) | |
tree | af6f77e57e6edca30af3539e64c5883ee66bd529 /Kernel/TTY/TTY.h | |
parent | 5f927904899b5ef6391d702979ef1e6048cecdf0 (diff) | |
download | serenity-ae6bdc4e29a6e38d0305d620b2301de6328dde0e.zip |
LibVT+Kernel: Clean up scroll API
This commit cleans up some of the `#ifdef`-ed code smell in
`Terminal`, by extending the scroll APIs to take a range of lines as a
parameter. This makes it possible to use the same code for `IL`/`DL` as
for scrolling.
Note that the current scrolling implementation is very naive, and does
many insertions/deletions in the middle of arrays, whereas swaps should
be enough. This optimization will come in a later commit.
The `linefeed` override was removed from `VirtualConsole`. Previously,
it exhibited incorrect behavior by moving to column 0. Now that we use
the method defined in `Terminal`, code which relied on this behavior
stopped working. We go instead go through the TTY layer which handles
the various output flags. Passing the input character-by-character
seems a bit excessive, so a fix for it will come in another PR.
Diffstat (limited to 'Kernel/TTY/TTY.h')
-rw-r--r-- | Kernel/TTY/TTY.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Kernel/TTY/TTY.h b/Kernel/TTY/TTY.h index 9e5ee61bfd..7813b0abf9 100644 --- a/Kernel/TTY/TTY.h +++ b/Kernel/TTY/TTY.h @@ -58,7 +58,7 @@ protected: TTY(unsigned major, unsigned minor); void emit(u8, bool do_evaluate_block_conditions = false); - virtual void echo(u8) = 0; + void echo_with_processing(u8); bool can_do_backspace() const; void do_backspace(); @@ -80,7 +80,8 @@ protected: private: // ^CharacterDevice virtual bool is_tty() const final override { return true; } - inline void echo_with_processing(u8); + + virtual void echo(u8) = 0; template<typename Functor> void process_output(u8, Functor put_char); |