This patch fixes an issue where ed wouldn't output the prompt until
exitting, due to stdout buffering. To fix it I simply added fflush after
the fputs that outputs the prompt.
Hope this is useful.
--
Samadi van Koten
>From c8e819361b0f331bdf586ba1abc0172892bf006b Mon Sep 17 00:00:00 2001
From: Samadi van Koten <[email protected]>
Date: Sun, 28 Jan 2018 14:51:38 +0000
Subject: [PATCH] Fix line buffering issue with ed prompt
This fixes an issue whereby ed would not output the prompt (when
enabled) until after exitting due to stdout being line-buffered.
---
ed.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/ed.c b/ed.c
index 4b28848..f45535c 100644
--- a/ed.c
+++ b/ed.c
@@ -1374,8 +1374,10 @@ edit(void)
ocurln = curln;
cmdsiz = 0;
repidx = -1;
- if (optprompt)
+ if (optprompt) {
fputs(prompt, stdout);
+ fflush(stdout);
+ }
getlst();
chkglobal() ? doglobal() : docmd();
}
--
2.11.0