From 4d4ee466f777724766ff8c5dd4fb6335a5053210 Mon Sep 17 00:00:00 2001 From: Lars Kellogg-Stedman Date: Tue, 8 Oct 2019 22:05:07 -0400 Subject: [PATCH] Disable line buffering in stdout In order for local echo to work properly, we have to either call fflush(stdout) after every character or just disable line buffering. This change uses setbuf(stdout, NULL) to do the latter. Closes #92 --- src/tty.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/tty.c b/src/tty.c index bee6f9f..afef44b 100644 --- a/src/tty.c +++ b/src/tty.c @@ -234,6 +234,10 @@ void stdout_configure(void) { int status; + /* Disable line buffering in stdout. This is necessary if we + * want things like local echo to work correctly. */ + setbuf(stdout, NULL); + /* Save current stdout settings */ if (tcgetattr(STDOUT_FILENO, &stdout_old) < 0) {