From 943defdbafac1677a758316a564810563cddb37c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B0=D0=BD=D0=B8=D0=BB=D0=B0=20=D0=93=D0=BE=D1=80?= =?UTF-8?q?=D0=BD=D1=83=D1=88=D0=BA=D0=BE?= Date: Wed, 22 Nov 2023 17:54:51 +0300 Subject: [PATCH] modify linenoiseClearScreen and linenoiseBeep --- components/linenoise-async/linenoise-async.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/components/linenoise-async/linenoise-async.c b/components/linenoise-async/linenoise-async.c index 7d6e1e9..6588e85 100644 --- a/components/linenoise-async/linenoise-async.c +++ b/components/linenoise-async/linenoise-async.c @@ -381,16 +381,15 @@ failed: /* Clear the screen. Used to handle ctrl+l */ void linenoiseClearScreen(void) { - if (write(STDOUT_FILENO,"\x1b[H\x1b[2J",7) <= 0) { - /* nothing to do, just to avoid warning. */ - } + fprintf(stdout, "\x1b[H\x1b[2J"); + flushWrite(); } /* Beep, used for completion when there is nothing to complete or when all * the choices were already shown. */ static void linenoiseBeep(void) { - fprintf(stderr, "\x7"); - fflush(stderr); + fprintf(stdout, "\x7"); + flushWrite(); } /* ============================== Completion ================================ */