mirror of
https://github.com/espressif/esp-idf
synced 2025-03-10 09:39:10 -04:00
fix(console): bug where backspace erases the prompt in dumb mode
This commit is contained in:
parent
c686e23038
commit
3766ebbd70
@ -1120,9 +1120,15 @@ static int linenoiseDumb(char* buf, size_t buflen, const char* prompt) {
|
|||||||
} else if (c == BACKSPACE || c == 0x8) {
|
} else if (c == BACKSPACE || c == 0x8) {
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
buf[count - 1] = 0;
|
buf[count - 1] = 0;
|
||||||
count --;
|
count--;
|
||||||
|
|
||||||
|
/* Only erase symbol echoed from stdin. */
|
||||||
|
fputs("\x08 ", stdout); /* Windows CMD: erase symbol under cursor */
|
||||||
|
flushWrite();
|
||||||
|
} else {
|
||||||
|
/* Consume backspace if the command line is empty to avoid erasing the prompt */
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
fputs("\x08 ", stdout); /* Windows CMD: erase symbol under cursor */
|
|
||||||
} else {
|
} else {
|
||||||
buf[count] = c;
|
buf[count] = c;
|
||||||
++count;
|
++count;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user