summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Blandy <jimb@redhat.com>1993-06-17 04:59:35 +0000
committerJim Blandy <jimb@redhat.com>1993-06-17 04:59:35 +0000
commit07f76a146652110694f36932a6a663ba832cf842 (patch)
treee3eadbf8bf10e61f5cbb1dac55d51373e04d6efb /src
parent5925bf38e186fdf5f24bc1d85bb22968d1a4e1d8 (diff)
downloademacs-07f76a146652110694f36932a6a663ba832cf842.tar.gz
* keyboard.c (read_key_sequence): If we add events to a key
sequence that didn't come from the input stream (e.g. `mode-line' prefixing a mouse click, or an expansion from function-key-map), and end up with a sequence that runs off the end of the current maps, return the entire key sequence, not just the initial portion which was bound or unbound.
Diffstat (limited to 'src')
-rw-r--r--src/keyboard.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index e7c692cbd6d..dd5e213a235 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -3816,13 +3816,8 @@ read_key_sequence (keybuf, bufsize, prompt)
if (t + 1 >= bufsize)
error ("key sequence too long");
keybuf[t] = posn;
- mock_input = t + 1;
-
- /* Put the rest on unread_command_events - that
- way, if the symbol isn't bound to a prefix map,
- then we don't lose the actual mouse event. */
- unread_command_events =
- Fcons (key, unread_command_events);
+ keybuf[t+1] = key;
+ mock_input = t + 2;
/* If we switched buffers while reading the first event,
replay in case we switched keymaps too. */
@@ -4052,6 +4047,19 @@ read_key_sequence (keybuf, bufsize, prompt)
done:
unread_switch_frame = delayed_switch_frame;
unbind_to (count, Qnil);
+
+ /* Occasionally we fabricate events, perhaps by expanding something
+ according to function-key-map, or by adding a prefix symbol to a
+ mouse click in the scroll bar or modeline. In this cases, return
+ the entire generated key sequence, even if we hit an unbound
+ prefix or a definition before the end. This means that you will
+ be able to push back the event properly, and also means that
+ read-key-sequence will always return a logical unit.
+
+ Better ideas? */
+ if (mock_input > t)
+ t = mock_input;
+
return t;
}