changeset 30936:29fae12cc834

(kbd_buffer_get_event): Handle the case that the second half of a HELP_EVENT is found at the start of kbd_buffer.
author Gerd Moellmann <gerd@gnu.org>
date Fri, 18 Aug 2000 03:13:27 +0000
parents b4d17c401854
children 5f266cae21c8
files src/keyboard.c
diffstat 1 files changed, 11 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/keyboard.c	Fri Aug 18 03:07:07 2000 +0000
+++ b/src/keyboard.c	Fri Aug 18 03:13:27 2000 +0000
@@ -3474,22 +3474,26 @@
 	kbd_fetch_ptr = event + 1;
       else if (event->kind == HELP_EVENT)
 	{
-	  /* There are always two consecutive HELP_EVENTs in the
-	     input queue.  */
+	  /* There are always two HELP_EVENTs in the input queue.  */
 	  Lisp_Object object, position, help, frame, window;
-	  
+
 	  xassert (event->code == 0);
 	  frame = event->frame_or_window;
 	  object = event->arg;
 	  position = event->x;
-	  xassert ((event + 1)->code == 1);
-	  help = (event + 1)->arg;
-	  window = (event + 1)->frame_or_window;
+
+	  kbd_fetch_ptr = event + 1;
+	  event = ((kbd_fetch_ptr < kbd_buffer + KBD_BUFFER_SIZE)
+		   ? kbd_fetch_ptr
+		   : kbd_buffer);
+	  xassert (event->code == 1);
+	  help = event->arg;
+	  window = event->frame_or_window;
 	  if (!WINDOWP (window))
 	    window = Qnil;
 	  obj = Fcons (Qhelp_echo,
 		       list5 (frame, help, window, object, position));
-	  kbd_fetch_ptr = event + 2;
+	  kbd_fetch_ptr = event + 1;
 	}
       else if (event->kind == FOCUS_IN_EVENT)
 	{