From 8ce742c7a2b95085f8d62b3f2e89fa07fcb84b84 Mon Sep 17 00:00:00 2001 From: Nguyễn Thái Ngọc Duy Date: Sat, 9 May 2009 16:58:40 +1000 Subject: win32: vi: reimplement mysleep() because poll() won't work on stdin This makes vi work on rxvt for Windows. There is work to do in winansi.c in order to make vim work on Windows console. --- editors/vi.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/editors/vi.c b/editors/vi.c index 602fc61d9..f59d5a706 100644 --- a/editors/vi.c +++ b/editors/vi.c @@ -2211,11 +2211,20 @@ static void catch_sig(int sig) static int mysleep(int hund) // sleep for 'hund' 1/100 seconds or stdin ready { +#if ENABLE_PLATFORM_MINGW32 + HANDLE h = GetStdHandle(STD_INPUT_HANDLE); + DWORD ret; + + fflush(stdout); + ret = WaitForSingleObject(h, hund*10); + return ret != WAIT_TIMEOUT; +#else struct pollfd pfd[1]; pfd[0].fd = STDIN_FILENO; pfd[0].events = POLLIN; return safe_poll(pfd, 1, hund*10) > 0; +#endif } //----- IO Routines -------------------------------------------- -- cgit v1.2.3-55-g6feb