Fixed read() being able to backspace even if there's nothing to backspace

This commit is contained in:
2024-05-19 10:56:17 +02:00
parent 9812f3f58d
commit d22536423c
+2 -1
View File
@@ -49,7 +49,8 @@ char* read() {
uint8_t len = 0;
while ((c = getc()) != '\n') {
if (c == '\b' && len > 0) {
if (c == '\b') {
if (len < 1) continue; // Can we backspace?
len--;
putc(c);
} else if (len + 1 != MAX_INPUT_LENGTH) { // Check if we can add a new character