bug-gdb
[Top][All Lists]
Advanced

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

input grabbing in RL callback


From: Golubev I. N.
Subject: input grabbing in RL callback
Date: Fri, 01 Dec 2000 16:24:14 (GMT)

This is essentially a digest of <address@hidden>
(<http://sources.redhat.com/ml/bug-gdb/2000-07/msg00000.html>) posted
to <address@hidden> and <address@hidden> on Sat, 01 Jul 2000
11:05:58 (GMT).

It is a bug in readline, but gdb-5 is, AFAIK, the only app affected by
it.  Shortly, rl_callback_read_char is expected to read exactly one
char of user input, but it can read more.  I still had no response
from readline maintainers.  Perhaps it is worth (temporarily) fixing
it in gdb independently.

I repeat patch here.  A clean solution is total rewrite of readline or
not using rl_callback_read_char.  It is explained in
<address@hidden> posted to <address@hidden> on
Mon, 03 Jul 2000 14:06:20 (GMT).

--- callback.c  2000/07/01 10:01:12     1.1
+++ callback.c  2000/07/01 10:15:45     1.2
@@ -102,25 +102,33 @@
 
   eof = readline_internal_char ();
 
-  if (rl_done)
+  do
     {
-      line = readline_internal_teardown (eof);
+      if (rl_done)
+       {
+         line = readline_internal_teardown (eof);
 
-      (*rl_deprep_term_function) ();
+         (*rl_deprep_term_function) ();
 #if defined (HANDLE_SIGNALS)
-      rl_clear_signals ();
+         rl_clear_signals ();
 #endif
-      in_handler = 0;
-      (*rl_linefunc) (line);
+         in_handler = 0;
+         (*rl_linefunc) (line);
 
-    /* If the user did not clear out the line, do it for him. */
-    if (rl_line_buffer[0])
-      _rl_init_line_state ();
+         /* If the user did not clear out the line, do it for him. */
+         if (rl_line_buffer[0])
+           _rl_init_line_state ();
 
-    /* Redisplay the prompt if readline_handler_{install,remove} not called. */
-      if (in_handler == 0 && rl_linefunc)
-       _rl_callback_newline ();
-    }
+         /* Redisplay the prompt if readline_handler_{install,remove} not 
called. */
+         if (in_handler == 0 && rl_linefunc)
+           _rl_callback_newline ();
+       }
+
+      if (rl_pending_input)
+       eof = readline_internal_char ();
+      else
+       break;
+    } while (1);
 }
 
 /* Remove the handler, and make sure the terminal is in its normal state. */



reply via email to

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