Made input text go to next line when it runs out of space instead of just wrapping around

This commit is contained in:
2024-05-02 10:01:26 +02:00
parent 437b423d19
commit 4a620a2e45
+14 -2
View File
@@ -129,12 +129,24 @@ void putc(char c) {
cursor.y++; cursor.y++;
cursor.x = 0; cursor.x = 0;
} else if (c == '\b') { } else if (c == '\b') {
putcAt(' ', cursor.x, cursor.y); // Make sure we don't leave an extra cursor TODO: make this better putcAt(' ', cursor.x, cursor.y); // Make sure we don't leave an extra cursor
cursor.x--;
if (cursor.x == 0) {
cursor.x = gfxMode->xRes / CHAR_WIDTH - 1; // Subtract one so we don't overflow to the line start
cursor.y--; // y could be 0
} else {
cursor.x--;
}
putcAt(' ', cursor.x, cursor.y); putcAt(' ', cursor.x, cursor.y);
} else { } else {
putcAt(c, cursor.x, cursor.y); putcAt(c, cursor.x, cursor.y);
cursor.x++; cursor.x++;
if (cursor.x >= gfxMode->xRes / CHAR_WIDTH) {
cursor.y++; // TODO: Scrolling
cursor.x = 0;
}
} }
} }