From 73742dcdaa26889735e7174b0587e9fe3f68cb09 Mon Sep 17 00:00:00 2001 From: Alexey Lapshin Date: Sun, 6 Aug 2023 18:15:40 +0400 Subject: [PATCH] fix(console): fix linenoise flushing in dumb mode --- components/console/linenoise/linenoise.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/console/linenoise/linenoise.c b/components/console/linenoise/linenoise.c index 48e510f521..965945aeda 100644 --- a/components/console/linenoise/linenoise.c +++ b/components/console/linenoise/linenoise.c @@ -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();