From 2d46281c160578b22ad0636bcfada95a26edf494 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Tue, 27 Dec 2022 17:45:47 +0200 Subject: [PATCH] Kernel: TTY scroll is now done using memmove This will be faster when memory functions will be optimized --- kernel/arch/i386/TTY.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/kernel/arch/i386/TTY.cpp b/kernel/arch/i386/TTY.cpp index 9ff63619..dcb9d1a3 100644 --- a/kernel/arch/i386/TTY.cpp +++ b/kernel/arch/i386/TTY.cpp @@ -303,10 +303,8 @@ void TTY::PutChar(char ch) while (m_row >= m_height) { - // Shift buffer one line up - for (size_t y = 1; y < m_height; y++) - for (size_t x = 0; x < m_width; x++) - m_buffer[(y - 1) * m_width + x] = m_buffer[y * m_width + x]; + memmove(m_buffer, m_buffer + m_width, m_width * (m_height - 1) * sizeof(Cell)); + // Clear last line in buffer for (size_t x = 0; x < m_width; x++) m_buffer[(m_height - 1) * m_width + x] = { .foreground = m_foreground, .background = m_background, .character = ' ' };