From d22536423ca8ce390c11e1bfcc12060383067620 Mon Sep 17 00:00:00 2001 From: Tom-on64 Date: Sun, 19 May 2024 10:56:17 +0200 Subject: [PATCH] Fixed read() being able to backspace even if there's nothing to backspace --- include/keyboard/keyboard.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/keyboard/keyboard.h b/include/keyboard/keyboard.h index 01c8208..8a12ed2 100644 --- a/include/keyboard/keyboard.h +++ b/include/keyboard/keyboard.h @@ -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