texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[8010] pause_or_input check buffer


From: gavinsmith0123
Subject: [8010] pause_or_input check buffer
Date: Tue, 7 Aug 2018 07:12:33 -0400 (EDT)

Revision: 8010
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=8010
Author:   gavin
Date:     2018-08-07 07:12:33 -0400 (Tue, 07 Aug 2018)
Log Message:
-----------
pause_or_input check buffer

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/info/echo-area.c
    trunk/info/session.c
    trunk/info/session.h

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2018-08-07 08:41:12 UTC (rev 8009)
+++ trunk/ChangeLog     2018-08-07 11:12:33 UTC (rev 8010)
@@ -1,3 +1,9 @@
+2018-08-07  Gavin Smith  <address@hidden>
+
+       * info/echo-area.c, info/session.c (pause_or_input):
+       Move to session.c.  Do not pause if there is already buffered 
+       input waiting.
+
 2018-08-07  Vitezslav Crhonek <address@hidden>  (tiny change)
 
        * info/echo-area.c (info_read_completing_internal): Avoid memory leak.

Modified: trunk/info/echo-area.c
===================================================================
--- trunk/info/echo-area.c      2018-08-07 08:41:12 UTC (rev 8009)
+++ trunk/info/echo-area.c      2018-08-07 11:12:33 UTC (rev 8010)
@@ -1517,36 +1517,6 @@
 /*                                                                  */
 /* **************************************************************** */
 
-#if defined (HAVE_SYS_TIME_H)
-#  include <sys/time.h>
-#  define HAVE_STRUCT_TIMEVAL
-#endif /* HAVE_SYS_TIME_H */
-
-#if !defined (FD_SET) && defined (__MINGW32__)
-#  define WIN32_LEAN_AND_MEAN
-#  include <windows.h>
-#endif
-
-static void
-pause_or_input (void)
-{
-#ifdef FD_SET
-  struct timeval timer;
-  fd_set readfds;
-
-  FD_ZERO (&readfds);
-  FD_SET (fileno (stdin), &readfds);
-  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 */
-}
-
 /* Print MESSAGE right after the end of the current line, and wait
    for input or a couple of seconds, whichever comes first.  Then flush the
    informational message that was printed. */

Modified: trunk/info/session.c
===================================================================
--- trunk/info/session.c        2018-08-07 08:41:12 UTC (rev 8009)
+++ trunk/info/session.c        2018-08-07 11:12:33 UTC (rev 8010)
@@ -739,6 +739,42 @@
         }
     }
 }
+
+#if defined (HAVE_SYS_TIME_H)
+#  include <sys/time.h>
+#  define HAVE_STRUCT_TIMEVAL
+#endif /* HAVE_SYS_TIME_H */
+
+#if !defined (FD_SET) && defined (__MINGW32__)
+#  define WIN32_LEAN_AND_MEAN
+#  include <windows.h>
+#endif
+
+void
+pause_or_input (void)
+{
+#ifdef FD_SET
+  struct timeval timer;
+  fd_set readfds;
+#endif
+
+  if (pop_index != push_index)
+    return; /* Input is already waiting. */
+
+#ifdef FD_SET
+  FD_ZERO (&readfds);
+  FD_SET (fileno (stdin), &readfds);
+  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 */
+}
+
 
 /* **************************************************************** */
 /*                                                                  */

Modified: trunk/info/session.h
===================================================================
--- trunk/info/session.h        2018-08-07 08:41:12 UTC (rev 8009)
+++ trunk/info/session.h        2018-08-07 11:12:33 UTC (rev 8010)
@@ -71,6 +71,7 @@
 FILE_BUFFER *file_buffer_of_window (WINDOW *window);
 int info_select_reference (WINDOW *window, REFERENCE *entry);
 int info_any_buffered_input_p (void);
+void pause_or_input (void);
 
 void dump_nodes_to_file (REFERENCE **references,
                                char *output_filename, int flags);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]