Mercurial > emacs
comparison src/keyboard.c @ 3799:1c2303940681
* 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.
author | Jim Blandy <jimb@redhat.com> |
---|---|
date | Thu, 17 Jun 1993 04:59:35 +0000 |
parents | 260c9c3200b1 |
children | 0f579c7269a3 |
comparison
equal
deleted
inserted
replaced
3798:84536053a592 | 3799:1c2303940681 |
---|---|
3814 else if (XTYPE (posn) == Lisp_Symbol) | 3814 else if (XTYPE (posn) == Lisp_Symbol) |
3815 { | 3815 { |
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. */ |
3829 if (buf != current_buffer && t == 0) | 3824 if (buf != current_buffer && t == 0) |
3830 goto replay_sequence; | 3825 goto replay_sequence; |
4050 : Qnil); | 4045 : Qnil); |
4051 | 4046 |
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 |
4058 DEFUN ("read-key-sequence", Fread_key_sequence, Sread_key_sequence, 1, 2, 0, | 4066 DEFUN ("read-key-sequence", Fread_key_sequence, Sread_key_sequence, 1, 2, 0, |
4059 "Read a sequence of keystrokes and return as a string or vector.\n\ | 4067 "Read a sequence of keystrokes and return as a string or vector.\n\ |