diff --git a/kernel/include/kernel/Terminal/Serial.h b/kernel/include/kernel/Terminal/Serial.h index fc6032a412..4abea34e3a 100644 --- a/kernel/include/kernel/Terminal/Serial.h +++ b/kernel/include/kernel/Terminal/Serial.h @@ -43,7 +43,8 @@ namespace Kernel virtual uint32_t width() const override; virtual uint32_t height() const override; - virtual void putchar_impl(uint8_t) override; + + virtual void clear() override { putchar_impl('\e'); putchar_impl('['); putchar_impl('2'); putchar_impl('J'); } virtual void update() override; @@ -51,6 +52,7 @@ namespace Kernel protected: virtual BAN::StringView name() const override { return m_name; } + virtual void putchar_impl(uint8_t) override; private: SerialTTY(Serial); diff --git a/kernel/include/kernel/Terminal/TTY.h b/kernel/include/kernel/Terminal/TTY.h index 5b876a2592..b5c87749ba 100644 --- a/kernel/include/kernel/Terminal/TTY.h +++ b/kernel/include/kernel/Terminal/TTY.h @@ -38,7 +38,8 @@ namespace Kernel virtual uint32_t height() const = 0; virtual uint32_t width() const = 0; void putchar(uint8_t ch); - virtual void putchar_impl(uint8_t ch) = 0; + + virtual void clear() = 0; virtual bool has_data_impl() const override; @@ -47,6 +48,7 @@ namespace Kernel : CharacterDevice(mode, uid, gid) { } + virtual void putchar_impl(uint8_t ch) = 0; virtual BAN::ErrorOr read_impl(off_t, void*, size_t) override; virtual BAN::ErrorOr write_impl(off_t, const void*, size_t) override; diff --git a/kernel/include/kernel/Terminal/VirtualTTY.h b/kernel/include/kernel/Terminal/VirtualTTY.h index 3f3fdbf458..e8b7a117f3 100644 --- a/kernel/include/kernel/Terminal/VirtualTTY.h +++ b/kernel/include/kernel/Terminal/VirtualTTY.h @@ -21,15 +21,16 @@ namespace Kernel virtual uint32_t height() const override { return m_height; } virtual uint32_t width() const override { return m_width; } - virtual void putchar_impl(uint8_t ch) override; + + virtual void clear() override; protected: virtual BAN::StringView name() const override { return m_name; } + virtual void putchar_impl(uint8_t ch) override; private: VirtualTTY(TerminalDriver*); - void clear(); void reset_ansi(); void handle_ansi_csi(uint8_t ch); void handle_ansi_csi_color(); diff --git a/kernel/kernel/Terminal/TTY.cpp b/kernel/kernel/Terminal/TTY.cpp index c25f7c3897..de2ed755e7 100644 --- a/kernel/kernel/Terminal/TTY.cpp +++ b/kernel/kernel/Terminal/TTY.cpp @@ -27,6 +27,7 @@ namespace Kernel void TTY::set_as_current() { s_tty = this; + clear(); auto inode_or_error = DevFileSystem::get().root_inode()->find_inode("tty"sv); if (inode_or_error.is_error())