timedcheck for input should have been checking buffer all along

This commit is contained in:
Adam D. Ruppe 2019-08-18 14:25:41 -04:00
parent f7b8a91d62
commit 11f9602ced
1 changed files with 13 additions and 9 deletions

View File

@ -1708,6 +1708,19 @@ struct RealTimeConsoleInput {
/// Check for input, waiting no longer than the number of milliseconds
bool timedCheckForInput(int milliseconds) {
if(inputQueue.length || timedCheckForInput_bypassingBuffer(timeout))
return true;
version(Posix)
if(interrupted || windowSizeChanged || hangedUp)
return true;
return false;
}
/* private */ bool anyInput_internal(int timeout = 0) {
return timedCheckForInput(timeout);
}
bool timedCheckForInput_bypassingBuffer(int milliseconds) {
version(Windows) {
auto response = WaitForSingleObject(terminal.hConsole, milliseconds);
if(response == 0)
@ -1733,15 +1746,6 @@ struct RealTimeConsoleInput {
}
}
/* private */ bool anyInput_internal() {
if(inputQueue.length || timedCheckForInput(0))
return true;
version(Posix)
if(interrupted || windowSizeChanged || hangedUp)
return true;
return false;
}
private dchar getchBuffer;
/// Get one key press from the terminal, discarding other