aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Moellmann2001-05-11 16:10:29 +0000
committerGerd Moellmann2001-05-11 16:10:29 +0000
commit2dc00208f215e385739a894ed77889e0a5e2caee (patch)
tree355e72c8d732c963053d2d6c1c7d3e966d5d00ef
parent752ef2545d7783997115e75199de43e3e7c02fe3 (diff)
downloademacs-2dc00208f215e385739a894ed77889e0a5e2caee.tar.gz
emacs-2dc00208f215e385739a894ed77889e0a5e2caee.zip
(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.
-rw-r--r--src/keyboard.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index e447211a277..2a7216f3975 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -7871,6 +7871,9 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
7871 volatile int function_key_possible = 0; 7871 volatile int function_key_possible = 0;
7872 volatile int key_translation_possible = 0; 7872 volatile int key_translation_possible = 0;
7873 7873
7874 /* List of events for which a fake prefix key has been generated. */
7875 volatile Lisp_Object fake_prefixed_keys = Qnil;
7876
7874 /* Save the status of key translation before each step, 7877 /* Save the status of key translation before each step,
7875 so that we can restore this after downcasing. */ 7878 so that we can restore this after downcasing. */
7876 Lisp_Object prev_fkey_map; 7879 Lisp_Object prev_fkey_map;
@@ -7885,6 +7888,9 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
7885 int junk; 7888 int junk;
7886#endif 7889#endif
7887 7890
7891 struct gcpro gcpro1;
7892
7893 GCPRO1 (fake_prefixed_keys);
7888 raw_keybuf_count = 0; 7894 raw_keybuf_count = 0;
7889 7895
7890 last_nonmenu_event = Qnil; 7896 last_nonmenu_event = Qnil;
@@ -8117,6 +8123,7 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
8117 if (EQ (key, Qt)) 8123 if (EQ (key, Qt))
8118 { 8124 {
8119 unbind_to (count, Qnil); 8125 unbind_to (count, Qnil);
8126 UNGCPRO;
8120 return -1; 8127 return -1;
8121 } 8128 }
8122 8129
@@ -8300,18 +8307,22 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
8300 8307
8301 /* Expand mode-line and scroll-bar events into two events: 8308 /* Expand mode-line and scroll-bar events into two events:
8302 use posn as a fake prefix key. */ 8309 use posn as a fake prefix key. */
8303 if (SYMBOLP (posn)) 8310 if (SYMBOLP (posn)
8311 && (NILP (fake_prefixed_keys)
8312 || NILP (Fmemq (key, fake_prefixed_keys))))
8304 { 8313 {
8305 if (t + 1 >= bufsize) 8314 if (t + 1 >= bufsize)
8306 error ("Key sequence too long"); 8315 error ("Key sequence too long");
8307 keybuf[t] = posn;
8308 keybuf[t+1] = key;
8309 mock_input = t + 2;
8310 8316
8311 /* Zap the position in key, so we know that we've 8317 keybuf[t] = posn;
8312 expanded it, and don't try to do so again. */ 8318 keybuf[t + 1] = key;
8313 POSN_BUFFER_POSN (EVENT_START (key)) 8319 mock_input = t + 2;
8314 = Fcons (posn, Qnil); 8320
8321 /* Record that a fake prefix key has been generated
8322 for KEY. Don't modify the event; this would
8323 prevent proper action when the event is pushed
8324 back tino unread-command-events. */
8325 fake_prefixed_keys = Fcons (key, fake_prefixed_keys);
8315 8326
8316 /* If on a mode line string with a local keymap, 8327 /* If on a mode line string with a local keymap,
8317 reconsider the key sequence with that keymap. */ 8328 reconsider the key sequence with that keymap. */
@@ -8880,6 +8891,7 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
8880 8891
8881 8892
8882 8893
8894 UNGCPRO;
8883 return t; 8895 return t;
8884} 8896}
8885 8897