Use TCSADRAIN when disabling raw mode as well

develop
lethosor 2015-10-14 15:58:27 -04:00
parent 36479dbcda
commit 96df70fe0b
1 changed files with 3 additions and 3 deletions

@ -396,7 +396,7 @@ namespace DFHack
// control chars - set return condition: min number of bytes and timer. // control chars - set return condition: min number of bytes and timer.
// We want read to return every single byte, without timeout. // We want read to return every single byte, without timeout.
raw.c_cc[VMIN] = 1; raw.c_cc[VTIME] = 0;// 1 byte, no timer raw.c_cc[VMIN] = 1; raw.c_cc[VTIME] = 0;// 1 byte, no timer
// put terminal in raw mode after flushing // put terminal in raw mode
if (tcsetattr(STDIN_FILENO, TCSADRAIN, &raw) < 0) if (tcsetattr(STDIN_FILENO, TCSADRAIN, &raw) < 0)
return -1; return -1;
rawmode = 1; rawmode = 1;
@ -406,7 +406,7 @@ namespace DFHack
void disable_raw() void disable_raw()
{ {
/* Don't even check the return value as it's too late. */ /* Don't even check the return value as it's too late. */
if (rawmode && tcsetattr(STDIN_FILENO,TCSAFLUSH,&orig_termios) != -1) if (rawmode && tcsetattr(STDIN_FILENO, TCSADRAIN, &orig_termios) != -1)
rawmode = 0; rawmode = 0;
} }
void prompt_refresh() void prompt_refresh()