From 74b77ba2acd4ed0873c2cbc621fdacd6360c4102 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Fri, 13 Oct 2023 12:43:52 +0300 Subject: [PATCH] Kernel: Debug temporary debug print just to beginning when full --- kernel/kernel/Debug.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/kernel/kernel/Debug.cpp b/kernel/kernel/Debug.cpp index 3fad4337..cf3ad175 100644 --- a/kernel/kernel/Debug.cpp +++ b/kernel/kernel/Debug.cpp @@ -74,6 +74,8 @@ namespace Debug static uint32_t col = 0; static uint32_t row = 0; + uint32_t row_copy = row; + if (ch == '\n') { row++; @@ -96,6 +98,19 @@ namespace Debug col = 0; } } + + if (row >= g_terminal_driver->height()) + row = 0; + + if (row != row_copy) + { + for (uint32_t i = col; i < g_terminal_driver->width(); i++) + { + g_terminal_driver->putchar_at(' ', i, row, TerminalColor::BRIGHT_WHITE, TerminalColor::BLACK); + if (row + 1 < g_terminal_driver->height()) + g_terminal_driver->putchar_at(' ', i, row + 1, TerminalColor::BRIGHT_WHITE, TerminalColor::BLACK); + } + } } }