Fixed prompt not showing properly in dumb frotz
authorBryce Lanham <blanham@gmail.com>
Tue, 11 Feb 2014 05:12:25 +0000 (23:12 -0600)
committerBryce Lanham <blanham@gmail.com>
Tue, 11 Feb 2014 05:12:25 +0000 (23:12 -0600)
Prompt was not showing up until after user submitted a line, because prompts
do not end with a newline, which would trigger fflush(). Adding a fflush() of
stdout fixes this.

src/dumb/dumb_input.c

index 7238ba3710ac02d6378ac5dc2ac4ddf99edf2a85..89be1778585d46d5ddf78947673c53e028486c22 100644 (file)
@@ -205,6 +205,8 @@ static bool dumb_read_line(char *s, char *prompt, bool show_cursor,
       fputs(prompt, stdout);
     else
       dumb_show_prompt(show_cursor, (timeout ? "tTD" : ")>}")[type]);
+       /* Prompt only shows up after user input if we don't flush stdout */
+       fflush(stdout);
     dumb_getline(s);
     if ((s[0] != '\\') || ((s[1] != '\0') && !islower(s[1]))) {
       /* Is not a command line.  */