aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--editors/vi.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/editors/vi.c b/editors/vi.c
index 433a37908..7b7f95cb1 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -2827,7 +2827,20 @@ static int mysleep(int hund) // sleep for 'hund' 1/100 seconds or stdin ready
2827 HANDLE h = GetStdHandle(STD_INPUT_HANDLE); 2827 HANDLE h = GetStdHandle(STD_INPUT_HANDLE);
2828 DWORD ret; 2828 DWORD ret;
2829 2829
2830 fflush(stdout); 2830 if (hund == 0) {
2831 /* Allow one event in the queue. Otherwise pasted test isn't
2832 * displayed because there's still a key release event waiting
2833 * after the last character is processed. */
2834 INPUT_RECORD record[2];
2835 DWORD nevent_out, mode;
2836
2837 GetConsoleMode(h, &mode);
2838 SetConsoleMode(h, 0);
2839 ret = PeekConsoleInput(h, record, 2, &nevent_out);
2840 GetConsoleMode(h, &mode);
2841 return ret == 0 ? (nevent_out > 1) : 0;
2842 }
2843 fflush_all();
2831 ret = WaitForSingleObject(h, hund*10); 2844 ret = WaitForSingleObject(h, hund*10);
2832 return ret != WAIT_TIMEOUT; 2845 return ret != WAIT_TIMEOUT;
2833#else 2846#else