aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJim Blandy1993-06-17 21:23:29 +0000
committerJim Blandy1993-06-17 21:23:29 +0000
commitcca310dacfa95c43da82eb74136c56ad285fc33b (patch)
tree8497029834b06462866beddecfa85a2da304227c /src
parente66feb07ede03b7f6c428ba1eb85347674f2b759 (diff)
downloademacs-cca310dacfa95c43da82eb74136c56ad285fc33b.tar.gz
emacs-cca310dacfa95c43da82eb74136c56ad285fc33b.zip
* keyboard.c (read_key_sequence): Don't confuse mock input with
function-key-map expansion, and continue reading mock events when the current sequence is unbound. * keyboard.c (read_key_sequence): After providing a prefix symbol for a mouse event, modify the mouse event to indicate that that won't need to be done again, by putting the event's position symbol in a list. * keyboard.c (read_key_sequence): When returning mock input which has run off the end of the current maps, make sure the events get echoed, and make it into this-command-keys. * keyboard.c (read_key_sequence): When re-reading a previously read mouse click which requires a prefix symbol, make sure to set last_real_key_start appropriately, so we can properly drop button-down events.
Diffstat (limited to 'src')
-rw-r--r--src/keyboard.c52
1 files changed, 32 insertions, 20 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index dd5e213a235..49d27b0dcdc 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -3687,11 +3687,14 @@ read_key_sequence (keybuf, bufsize, prompt)
3687 if (INTERACTIVE) 3687 if (INTERACTIVE)
3688 echo_truncate (echo_start); 3688 echo_truncate (echo_start);
3689 3689
3690 /* If the best binding for the current key sequence is a keymap, 3690 /* If the best binding for the current key sequence is a keymap, or
3691 or we may be looking at a function key's escape sequence, keep 3691 we may be looking at a function key's escape sequence, keep on
3692 on reading. */ 3692 reading. */
3693 while ((first_binding < nmaps && ! NILP (submaps[first_binding])) 3693 while ((first_binding < nmaps && ! NILP (submaps[first_binding]))
3694 || (first_binding >= nmaps && fkey_start < t)) 3694 || (first_binding >= nmaps
3695 && fkey_start < t
3696 /* mock input is never part of a function key's sequence. */
3697 && mock_input <= fkey_start))
3695 { 3698 {
3696 Lisp_Object key; 3699 Lisp_Object key;
3697 int used_mouse_menu = 0; 3700 int used_mouse_menu = 0;
@@ -3763,7 +3766,11 @@ read_key_sequence (keybuf, bufsize, prompt)
3763 Furthermore, key sequences beginning with mouse clicks 3766 Furthermore, key sequences beginning with mouse clicks
3764 are read using the keymaps of the buffer clicked on, not 3767 are read using the keymaps of the buffer clicked on, not
3765 the current buffer. So we may have to switch the buffer 3768 the current buffer. So we may have to switch the buffer
3766 here. */ 3769 here.
3770
3771 If the event was obtained from the unread_command_events
3772 queue, then don't expand it; we did that the first time
3773 we read it. */
3767 if (EVENT_HAS_PARAMETERS (key)) 3774 if (EVENT_HAS_PARAMETERS (key))
3768 { 3775 {
3769 Lisp_Object kind = EVENT_HEAD_KIND (EVENT_HEAD (key)); 3776 Lisp_Object kind = EVENT_HEAD_KIND (EVENT_HEAD (key));
@@ -3782,19 +3789,8 @@ read_key_sequence (keybuf, bufsize, prompt)
3782 && XTYPE (XWINDOW (window)->buffer) == Lisp_Buffer 3789 && XTYPE (XWINDOW (window)->buffer) == Lisp_Buffer
3783 && XBUFFER (XWINDOW (window)->buffer) != current_buffer) 3790 && XBUFFER (XWINDOW (window)->buffer) != current_buffer)
3784 { 3791 {
3785 if (XTYPE (posn) == Lisp_Symbol) 3792 keybuf[t] = key;
3786 { 3793 mock_input = t + 1;
3787 if (t + 1 >= bufsize)
3788 error ("key sequence too long");
3789 keybuf[t] = posn;
3790 keybuf[t+1] = key;
3791 mock_input = t + 2;
3792 }
3793 else
3794 {
3795 keybuf[t] = key;
3796 mock_input = t + 1;
3797 }
3798 3794
3799 /* Arrange to go back to the original buffer once we're 3795 /* Arrange to go back to the original buffer once we're
3800 done reading the key sequence. Note that we can't 3796 done reading the key sequence. Note that we can't
@@ -3819,12 +3815,25 @@ read_key_sequence (keybuf, bufsize, prompt)
3819 keybuf[t+1] = key; 3815 keybuf[t+1] = key;
3820 mock_input = t + 2; 3816 mock_input = t + 2;
3821 3817
3818 /* Zap the position in key, so we know that we've
3819 expanded it, and don't try to do so again. */
3820 POSN_BUFFER_POSN (EVENT_START (key))
3821 = Fcons (posn, Qnil);
3822
3822 /* If we switched buffers while reading the first event, 3823 /* If we switched buffers while reading the first event,
3823 replay in case we switched keymaps too. */ 3824 replay in case we switched keymaps too. */
3824 if (buf != current_buffer && t == 0) 3825 if (buf != current_buffer && t == 0)
3825 goto replay_sequence; 3826 goto replay_sequence;
3826 goto replay_key; 3827 goto replay_key;
3827 } 3828 }
3829 else if (XTYPE (posn) == Lisp_Cons)
3830 {
3831 /* We're looking at the second event of a
3832 sequence which we expanded before. Set
3833 last_real_key_start appropriately. */
3834 if (last_real_key_start == t && t > 0)
3835 last_real_key_start = t - 1;
3836 }
3828 } 3837 }
3829 else if (EQ (kind, Qswitch_frame)) 3838 else if (EQ (kind, Qswitch_frame))
3830 { 3839 {
@@ -4057,8 +4066,11 @@ read_key_sequence (keybuf, bufsize, prompt)
4057 read-key-sequence will always return a logical unit. 4066 read-key-sequence will always return a logical unit.
4058 4067
4059 Better ideas? */ 4068 Better ideas? */
4060 if (mock_input > t) 4069 for (; t < mock_input; t++)
4061 t = mock_input; 4070 {
4071 echo_char (keybuf[t]);
4072 add_command_key (keybuf[t]);
4073 }
4062 4074
4063 return t; 4075 return t;
4064} 4076}