modify linenoiseClearScreen and linenoiseBeep

This commit is contained in:
Данила Горнушко 2023-11-22 17:54:51 +03:00
parent 7c636e2c13
commit 943defdbaf

View file

@ -381,16 +381,15 @@ failed:
/* Clear the screen. Used to handle ctrl+l */ /* Clear the screen. Used to handle ctrl+l */
void linenoiseClearScreen(void) { void linenoiseClearScreen(void) {
if (write(STDOUT_FILENO,"\x1b[H\x1b[2J",7) <= 0) { fprintf(stdout, "\x1b[H\x1b[2J");
/* nothing to do, just to avoid warning. */ flushWrite();
}
} }
/* Beep, used for completion when there is nothing to complete or when all /* Beep, used for completion when there is nothing to complete or when all
* the choices were already shown. */ * the choices were already shown. */
static void linenoiseBeep(void) { static void linenoiseBeep(void) {
fprintf(stderr, "\x7"); fprintf(stdout, "\x7");
fflush(stderr); flushWrite();
} }
/* ============================== Completion ================================ */ /* ============================== Completion ================================ */