summaryrefslogtreecommitdiff
path: root/Kernel/TTY/VirtualConsole.h
diff options
context:
space:
mode:
authorDaniel Bertalan <dani@danielbertalan.dev>2021-06-02 15:36:31 +0200
committerAndreas Kling <kling@serenityos.org>2021-06-10 17:18:02 +0200
commitae6bdc4e29a6e38d0305d620b2301de6328dde0e (patch)
treeaf6f77e57e6edca30af3539e64c5883ee66bd529 /Kernel/TTY/VirtualConsole.h
parent5f927904899b5ef6391d702979ef1e6048cecdf0 (diff)
downloadserenity-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/VirtualConsole.h')
-rw-r--r--Kernel/TTY/VirtualConsole.h13
1 files changed, 4 insertions, 9 deletions
diff --git a/Kernel/TTY/VirtualConsole.h b/Kernel/TTY/VirtualConsole.h
index fe0b62a23c..69f6eecf90 100644
--- a/Kernel/TTY/VirtualConsole.h
+++ b/Kernel/TTY/VirtualConsole.h
@@ -37,17 +37,12 @@ private:
virtual void clear() override;
virtual void clear_including_history() override;
- virtual void scroll_up() override;
- virtual void scroll_down() override;
- virtual void linefeed() override;
+ virtual void scroll_up(u16 region_top, u16 region_bottom, size_t count) override;
+ virtual void scroll_down(u16 region_top, u16 region_bottom, size_t count) override;
virtual void put_character_at(unsigned row, unsigned column, u32 ch) override;
- virtual void set_window_title(const String&) override;
virtual void ICH(Parameters) override;
-
- virtual void IL(Parameters) override;
virtual void DCH(Parameters) override;
- virtual void DL(Parameters) override;
};
class VirtualConsole final : public TTY
@@ -140,8 +135,8 @@ private:
void on_code_point(u32);
- void scroll_down();
- void scroll_up();
+ void scroll_down(u16 region_top, u16 region_bottom, size_t count);
+ void scroll_up(u16 region_top, u16 region_bottom, size_t count);
void clear_line(size_t index);
void put_character_at(unsigned row, unsigned column, u32 ch, const VT::Attribute&);