changeset 37689:4fe5b946a4af

(read_key_sequence): Don't modify events when generating fake prefix keys (mode-line, scroll-bar, ...) since this prevents proper processing of such events when pushed back into unread-command-events.
author Gerd Moellmann <gerd@gnu.org>
date Fri, 11 May 2001 16:10:29 +0000
parents 187a17e0e802
children f62f3fe5bc89
files src/keyboard.c
diffstat 1 files changed, 20 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/keyboard.c	Fri May 11 15:12:08 2001 +0000
+++ b/src/keyboard.c	Fri May 11 16:10:29 2001 +0000
@@ -7871,6 +7871,9 @@
   volatile int function_key_possible = 0;
   volatile int key_translation_possible = 0;
 
+  /* List of events for which a fake prefix key has been generated.  */
+  volatile Lisp_Object fake_prefixed_keys = Qnil;
+
   /* Save the status of key translation before each step,
      so that we can restore this after downcasing.  */
   Lisp_Object prev_fkey_map;
@@ -7885,6 +7888,9 @@
   int junk;
 #endif
 
+  struct gcpro gcpro1;
+
+  GCPRO1 (fake_prefixed_keys);
   raw_keybuf_count = 0;
 
   last_nonmenu_event = Qnil;
@@ -8117,6 +8123,7 @@
 	  if (EQ (key, Qt))
 	    {
 	      unbind_to (count, Qnil);
+	      UNGCPRO;
 	      return -1;
 	    }
 
@@ -8300,18 +8307,22 @@
 
 	      /* Expand mode-line and scroll-bar events into two events:
 		 use posn as a fake prefix key.  */
-	      if (SYMBOLP (posn))
+	      if (SYMBOLP (posn)
+		  && (NILP (fake_prefixed_keys)
+		      || NILP (Fmemq (key, fake_prefixed_keys))))
 		{
 		  if (t + 1 >= bufsize)
 		    error ("Key sequence too long");
-		  keybuf[t] = posn;
-		  keybuf[t+1] = key;
-		  mock_input = t + 2;
 		  
-		  /* Zap the position in key, so we know that we've
-		     expanded it, and don't try to do so again.  */
-		  POSN_BUFFER_POSN (EVENT_START (key))
-		    = Fcons (posn, Qnil);
+		  keybuf[t]     = posn;
+		  keybuf[t + 1] = key;
+		  mock_input    = t + 2;
+
+		  /* Record that a fake prefix key has been generated
+		     for KEY.  Don't modify the event; this would
+		     prevent proper action when the event is pushed
+		     back tino unread-command-events.  */
+		  fake_prefixed_keys = Fcons (key, fake_prefixed_keys);
 
 		  /* If on a mode line string with a local keymap,
 		     reconsider the key sequence with that keymap.  */
@@ -8880,6 +8891,7 @@
 
   
 
+  UNGCPRO;
   return t;
 }