From 0e26e2ff3b87f8db635d3c7dca23f441a3961fd2 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Fri, 1 Feb 2019 12:47:55 +0000 Subject: vi: simplify code to display pasted text --- editors/vi.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/editors/vi.c b/editors/vi.c index 7b7f95cb1..3c758cca0 100644 --- a/editors/vi.c +++ b/editors/vi.c @@ -2831,14 +2831,10 @@ static int mysleep(int hund) // sleep for 'hund' 1/100 seconds or stdin ready /* Allow one event in the queue. Otherwise pasted test isn't * displayed because there's still a key release event waiting * after the last character is processed. */ - INPUT_RECORD record[2]; - DWORD nevent_out, mode; - - GetConsoleMode(h, &mode); - SetConsoleMode(h, 0); - ret = PeekConsoleInput(h, record, 2, &nevent_out); - GetConsoleMode(h, &mode); - return ret == 0 ? (nevent_out > 1) : 0; + DWORD nevent_out; + + ret = GetNumberOfConsoleInputEvents(h, &nevent_out); + return ret != 0 ? (nevent_out > 1) : 0; } fflush_all(); ret = WaitForSingleObject(h, hund*10); -- cgit v1.2.3-55-g6feb