Kernel: Fix TTY scroll clearing first and/or last characters from line

This commit is contained in:
Bananymous 2024-07-16 22:49:49 +03:00
parent 58fcd2b2fe
commit 7a0fb9a57f
1 changed files with 5 additions and 6 deletions

View File

@ -364,6 +364,10 @@ namespace Kernel
ASSERT_NOT_REACHED(); ASSERT_NOT_REACHED();
} }
bool old_show_cursor = m_show_cursor;
m_show_cursor = false;
set_cursor_position(m_column, m_row);
switch (codepoint) switch (codepoint)
{ {
case BEL: // TODO case BEL: // TODO
@ -410,10 +414,6 @@ namespace Kernel
for (uint32_t x = 0; x < m_width; x++) for (uint32_t x = 0; x < m_width; x++)
m_buffer[(m_height - 1) * m_width + x] = { .foreground = m_foreground, .background = m_background, .codepoint = ' ' }; 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)) if (!m_terminal_driver->scroll(m_background))
{ {
// No fast scrolling, render the whole buffer to the screen // 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++) for (uint32_t x = 0; x < m_width; x++)
render_from_buffer(x, y); render_from_buffer(x, y);
} }
m_show_cursor = old_show_cursor;
m_column = 0; m_column = 0;
m_row--; m_row--;
} }
m_show_cursor = old_show_cursor;
set_cursor_position(m_column, m_row); set_cursor_position(m_column, m_row);
} }