mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
fix(console): fix linenoise flushing in dumb mode
This commit is contained in:
parent
9dcc9a73f6
commit
73742dcdaa
@ -1092,6 +1092,7 @@ static int linenoiseRaw(char *buf, size_t buflen, const char *prompt) {
|
||||
static int linenoiseDumb(char* buf, size_t buflen, const char* prompt) {
|
||||
/* dumb terminal, fall back to fgets */
|
||||
fputs(prompt, stdout);
|
||||
flushWrite();
|
||||
size_t count = 0;
|
||||
while (count < buflen) {
|
||||
int c = fgetc(stdin);
|
||||
@ -1105,11 +1106,13 @@ static int linenoiseDumb(char* buf, size_t buflen, const char* prompt) {
|
||||
count --;
|
||||
}
|
||||
fputs("\x08 ", stdout); /* Windows CMD: erase symbol under cursor */
|
||||
flushWrite();
|
||||
} else {
|
||||
buf[count] = c;
|
||||
++count;
|
||||
}
|
||||
fputc(c, stdout); /* echo */
|
||||
flushWrite();
|
||||
}
|
||||
fputc('\n', stdout);
|
||||
flushWrite();
|
||||
|
Loading…
Reference in New Issue
Block a user