diff -urp texinfo-6-3/info/echo-area.c texinfo-6.3/info/echo-area.c --- texinfo-6-3/info/echo-area.c 2015-09-30 23:13:31 +1000 +++ texinfo-6.3/info/echo-area.c 2017-01-21 15:35:12 +1000 @@ -1525,6 +1525,11 @@ echo_area_stack_contains_completions_p ( # define HAVE_STRUCT_TIMEVAL #endif /* HAVE_SYS_TIME_H */ +#if !defined (FD_SET) && defined (__MINGW32__) +# define WIN32_LEAN_AND_MEAN +# include +#endif + static void pause_or_input (void) { @@ -1537,6 +1542,11 @@ pause_or_input (void) timer.tv_sec = 2; timer.tv_usec = 0; select (fileno (stdin) + 1, &readfds, NULL, NULL, &timer); +#elif defined (__MINGW32__) + /* This is signalled on key release, so flush it and wait again. */ + WaitForSingleObject (GetStdHandle (STD_INPUT_HANDLE), 2000); + FlushConsoleInputBuffer (GetStdHandle (STD_INPUT_HANDLE)); + WaitForSingleObject (GetStdHandle (STD_INPUT_HANDLE), 2000); #endif /* FD_SET */ } diff -urp texinfo-6-3/info/pcterm.c texinfo-6.3/info/pcterm.c --- texinfo-6-3/info/pcterm.c 2016-09-03 23:09:25 +1000 +++ texinfo-6.3/info/pcterm.c 2017-01-21 15:35:12 +1000 @@ -174,10 +185,11 @@ gettextinfo (struct text_info *ti) hstdin = GetStdHandle (STD_INPUT_HANDLE); hstdout = GetStdHandle (STD_OUTPUT_HANDLE); - if (hstdin != INVALID_HANDLE_VALUE - && hstdout != INVALID_HANDLE_VALUE - && GetConsoleMode (hstdout, &ignored) - && GetConsoleMode (hstdin, &old_inpmode)) + if (!GetConsoleMode (hstdin, &ignored)) + hstdin = INVALID_HANDLE_VALUE; + + if (hstdout != INVALID_HANDLE_VALUE + && GetConsoleMode (hstdout, &ignored)) { hinfo = CreateConsoleScreenBuffer (GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, @@ -486,15 +518,9 @@ sleep (unsigned sec) static int w32_our_tty (int fd) { - return - isatty (fd) - /* Windows `isatty' actually tests for character devices, so the - null device gets reported as a tty. Fix that by calling - `lseek'. */ - && lseek (fd, SEEK_CUR, 0) == -1 - /* Is this our tty? */ - && hstdin != INVALID_HANDLE_VALUE - && hstdin == (HANDLE)_get_osfhandle (fd); + /* Is this our tty? */ + return hstdin != INVALID_HANDLE_VALUE + && hstdin == (HANDLE)_get_osfhandle (fd); } /* Translate a Windows key event into the equivalent sequence of bytes @@ -1211,6 +1301,10 @@ pc_initialize_terminal (term_name) term_ke = (char *)find_sequence (K_End); term_ki = (char *)find_sequence (K_Insert); term_kD = (char *)find_sequence (K_Delete); +#elif defined _WIN32 + term_kh = "\033<"; + term_ke = "\033>"; + term_ki = "\033[L"; #endif /* __MSDOS__ */ /* Set all the hooks to our PC-specific functions. */