From a33a1c96faebf42b0efad0802bbe349a342e6979 Mon Sep 17 00:00:00 2001 From: starnakin Date: Sat, 7 Sep 2024 01:59:20 +0200 Subject: [PATCH] support \n --- src/terminal/terminal.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/terminal/terminal.c b/src/terminal/terminal.c index e3d7b25..d782231 100644 --- a/src/terminal/terminal.c +++ b/src/terminal/terminal.c @@ -1,5 +1,6 @@ #include "terminal.h" #include "string.h" +#include "ctype.h" #include #include @@ -50,6 +51,13 @@ void terminal_putentryat(char c, uint8_t color, size_t x, size_t y) int terminal_putchar(char c) { + if (c == '\n') { + terminal_column = 0; + terminal_row++; + return 1; + } + if (!isprint(c)) + return 1; terminal_putentryat(c, terminal_color, terminal_column, terminal_row); if (++terminal_column == VGA_WIDTH) { terminal_column = 0;