From 11f9602cedb43d57e8217f6d0c8f29fab1123b5e Mon Sep 17 00:00:00 2001 From: "Adam D. Ruppe" Date: Sun, 18 Aug 2019 14:25:41 -0400 Subject: [PATCH] timedcheck for input should have been checking buffer all along --- terminal.d | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/terminal.d b/terminal.d index 7ab3dc5..0ec037c 100644 --- a/terminal.d +++ b/terminal.d @@ -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