From 7a0fb9a57f550c9c18aa1e1ed857db14b58ed603 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Tue, 16 Jul 2024 22:49:49 +0300 Subject: [PATCH] Kernel: Fix TTY scroll clearing first and/or last characters from line --- kernel/kernel/Terminal/VirtualTTY.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/kernel/kernel/Terminal/VirtualTTY.cpp b/kernel/kernel/Terminal/VirtualTTY.cpp index 51e84ee6f8..caa8fea4e1 100644 --- a/kernel/kernel/Terminal/VirtualTTY.cpp +++ b/kernel/kernel/Terminal/VirtualTTY.cpp @@ -364,6 +364,10 @@ namespace Kernel ASSERT_NOT_REACHED(); } + bool old_show_cursor = m_show_cursor; + m_show_cursor = false; + set_cursor_position(m_column, m_row); + switch (codepoint) { case BEL: // TODO @@ -410,10 +414,6 @@ namespace Kernel for (uint32_t x = 0; x < m_width; x++) m_buffer[(m_height - 1) * m_width + x] = { .foreground = m_foreground, .background = m_background, .codepoint = ' ' }; - // hide cursor during scrolling - bool old_show_cursor = m_show_cursor; - m_show_cursor = false; - set_cursor_position(0, 0); if (!m_terminal_driver->scroll(m_background)) { // No fast scrolling, render the whole buffer to the screen @@ -421,13 +421,12 @@ namespace Kernel for (uint32_t x = 0; x < m_width; x++) render_from_buffer(x, y); } - m_show_cursor = old_show_cursor; - m_column = 0; m_row--; } + m_show_cursor = old_show_cursor; set_cursor_position(m_column, m_row); }