Flushing input prior to getch()

modified:   src/nms.c
This commit is contained in:
Brian Barto 2016-04-20 12:39:39 -04:00
parent 0f5db67cac
commit 1782f6d248
1 changed files with 6 additions and 0 deletions

View File

@ -131,6 +131,9 @@ char nmsexec(char *src) {
usleep(TYPE_EFFECT_SPEED * 1000);
}
// Flush any input up to this point
flushinp();
// Reopen stdin for interactive input (keyboard), then require user
// to press a key to continue.
if (!isatty(STDIN_FILENO))
@ -215,6 +218,9 @@ char nmsexec(char *src) {
attroff(COLOR_PAIR(1));
}
// Flush any input up to this point
flushinp();
// If stdin is set to the keyboard, user must press a key to continue
if (isatty(STDIN_FILENO))
ret = getch();