mirror of https://github.com/adamdruppe/arsd.git
timedcheck for input should have been checking buffer all along
This commit is contained in:
parent
f7b8a91d62
commit
11f9602ced
22
terminal.d
22
terminal.d
|
|
@ -1708,6 +1708,19 @@ struct RealTimeConsoleInput {
|
||||||
|
|
||||||
/// Check for input, waiting no longer than the number of milliseconds
|
/// Check for input, waiting no longer than the number of milliseconds
|
||||||
bool timedCheckForInput(int 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) {
|
version(Windows) {
|
||||||
auto response = WaitForSingleObject(terminal.hConsole, milliseconds);
|
auto response = WaitForSingleObject(terminal.hConsole, milliseconds);
|
||||||
if(response == 0)
|
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;
|
private dchar getchBuffer;
|
||||||
|
|
||||||
/// Get one key press from the terminal, discarding other
|
/// Get one key press from the terminal, discarding other
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue