mirror of
https://github.com/Tom-on64/kern.git
synced 2026-11-03 18:22:22 +00:00
Fixed read() being able to backspace even if there's nothing to backspace
This commit is contained in:
@@ -49,7 +49,8 @@ char* read() {
|
|||||||
uint8_t len = 0;
|
uint8_t len = 0;
|
||||||
|
|
||||||
while ((c = getc()) != '\n') {
|
while ((c = getc()) != '\n') {
|
||||||
if (c == '\b' && len > 0) {
|
if (c == '\b') {
|
||||||
|
if (len < 1) continue; // Can we backspace?
|
||||||
len--;
|
len--;
|
||||||
putc(c);
|
putc(c);
|
||||||
} else if (len + 1 != MAX_INPUT_LENGTH) { // Check if we can add a new character
|
} else if (len + 1 != MAX_INPUT_LENGTH) { // Check if we can add a new character
|
||||||
|
|||||||
Reference in New Issue
Block a user