diff options
| author | Jim Blandy | 1993-06-17 04:59:35 +0000 |
|---|---|---|
| committer | Jim Blandy | 1993-06-17 04:59:35 +0000 |
| commit | 07f76a146652110694f36932a6a663ba832cf842 (patch) | |
| tree | e3eadbf8bf10e61f5cbb1dac55d51373e04d6efb /src | |
| parent | 5925bf38e186fdf5f24bc1d85bb22968d1a4e1d8 (diff) | |
| download | emacs-07f76a146652110694f36932a6a663ba832cf842.tar.gz emacs-07f76a146652110694f36932a6a663ba832cf842.zip | |
* 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.c | 22 |
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) | |||
| 3816 | if (t + 1 >= bufsize) | 3816 | if (t + 1 >= bufsize) |
| 3817 | error ("key sequence too long"); | 3817 | error ("key sequence too long"); |
| 3818 | keybuf[t] = posn; | 3818 | keybuf[t] = posn; |
| 3819 | mock_input = t + 1; | 3819 | keybuf[t+1] = key; |
| 3820 | 3820 | mock_input = t + 2; | |
| 3821 | /* Put the rest on unread_command_events - that | ||
| 3822 | way, if the symbol isn't bound to a prefix map, | ||
| 3823 | then we don't lose the actual mouse event. */ | ||
| 3824 | unread_command_events = | ||
| 3825 | Fcons (key, unread_command_events); | ||
| 3826 | 3821 | ||
| 3827 | /* If we switched buffers while reading the first event, | 3822 | /* If we switched buffers while reading the first event, |
| 3828 | replay in case we switched keymaps too. */ | 3823 | replay in case we switched keymaps too. */ |
| @@ -4052,6 +4047,19 @@ read_key_sequence (keybuf, bufsize, prompt) | |||
| 4052 | done: | 4047 | done: |
| 4053 | unread_switch_frame = delayed_switch_frame; | 4048 | unread_switch_frame = delayed_switch_frame; |
| 4054 | unbind_to (count, Qnil); | 4049 | unbind_to (count, Qnil); |
| 4050 | |||
| 4051 | /* Occasionally we fabricate events, perhaps by expanding something | ||
| 4052 | according to function-key-map, or by adding a prefix symbol to a | ||
| 4053 | mouse click in the scroll bar or modeline. In this cases, return | ||
| 4054 | the entire generated key sequence, even if we hit an unbound | ||
| 4055 | prefix or a definition before the end. This means that you will | ||
| 4056 | be able to push back the event properly, and also means that | ||
| 4057 | read-key-sequence will always return a logical unit. | ||
| 4058 | |||
| 4059 | Better ideas? */ | ||
| 4060 | if (mock_input > t) | ||
| 4061 | t = mock_input; | ||
| 4062 | |||
| 4055 | return t; | 4063 | return t; |
| 4056 | } | 4064 | } |
| 4057 | 4065 | ||