mirror of
https://github.com/Tom-on64/kern.git
synced 2026-11-03 18:22:22 +00:00
Made input text go to next line when it runs out of space instead of just wrapping around
This commit is contained in:
+14
-2
@@ -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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user