support \n

This commit is contained in:
starnakin 2024-09-07 01:59:20 +02:00
parent 792f8f1283
commit a33a1c96fa

View File

@ -1,5 +1,6 @@
#include "terminal.h" #include "terminal.h"
#include "string.h" #include "string.h"
#include "ctype.h"
#include <stdbool.h> #include <stdbool.h>
#include <stddef.h> #include <stddef.h>
@ -50,6 +51,13 @@ void terminal_putentryat(char c, uint8_t color, size_t x, size_t y)
int terminal_putchar(char c) 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); terminal_putentryat(c, terminal_color, terminal_column, terminal_row);
if (++terminal_column == VGA_WIDTH) { if (++terminal_column == VGA_WIDTH) {
terminal_column = 0; terminal_column = 0;