Mercurial > emacs
changeset 3809:0f579c7269a3
* 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.
author | Jim Blandy <jimb@redhat.com> |
---|---|
date | Thu, 17 Jun 1993 21:23:29 +0000 |
parents | d852157f581a |
children | 87d9ef5f831b |
files | src/keyboard.c |
diffstat | 1 files changed, 32 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/src/keyboard.c Thu Jun 17 18:17:32 1993 +0000 +++ b/src/keyboard.c Thu Jun 17 21:23:29 1993 +0000 @@ -3687,11 +3687,14 @@ if (INTERACTIVE) echo_truncate (echo_start); - /* If the best binding for the current key sequence is a keymap, - or we may be looking at a function key's escape sequence, keep - on reading. */ + /* If the best binding for the current key sequence is a keymap, or + we may be looking at a function key's escape sequence, keep on + reading. */ while ((first_binding < nmaps && ! NILP (submaps[first_binding])) - || (first_binding >= nmaps && fkey_start < t)) + || (first_binding >= nmaps + && fkey_start < t + /* mock input is never part of a function key's sequence. */ + && mock_input <= fkey_start)) { Lisp_Object key; int used_mouse_menu = 0; @@ -3763,7 +3766,11 @@ Furthermore, key sequences beginning with mouse clicks are read using the keymaps of the buffer clicked on, not the current buffer. So we may have to switch the buffer - here. */ + here. + + If the event was obtained from the unread_command_events + queue, then don't expand it; we did that the first time + we read it. */ if (EVENT_HAS_PARAMETERS (key)) { Lisp_Object kind = EVENT_HEAD_KIND (EVENT_HEAD (key)); @@ -3782,19 +3789,8 @@ && XTYPE (XWINDOW (window)->buffer) == Lisp_Buffer && XBUFFER (XWINDOW (window)->buffer) != current_buffer) { - if (XTYPE (posn) == Lisp_Symbol) - { - if (t + 1 >= bufsize) - error ("key sequence too long"); - keybuf[t] = posn; - keybuf[t+1] = key; - mock_input = t + 2; - } - else - { - keybuf[t] = key; - mock_input = t + 1; - } + keybuf[t] = key; + mock_input = t + 1; /* Arrange to go back to the original buffer once we're done reading the key sequence. Note that we can't @@ -3819,12 +3815,25 @@ keybuf[t+1] = key; mock_input = t + 2; + /* Zap the position in key, so we know that we've + expanded it, and don't try to do so again. */ + POSN_BUFFER_POSN (EVENT_START (key)) + = Fcons (posn, Qnil); + /* If we switched buffers while reading the first event, replay in case we switched keymaps too. */ if (buf != current_buffer && t == 0) goto replay_sequence; goto replay_key; } + else if (XTYPE (posn) == Lisp_Cons) + { + /* We're looking at the second event of a + sequence which we expanded before. Set + last_real_key_start appropriately. */ + if (last_real_key_start == t && t > 0) + last_real_key_start = t - 1; + } } else if (EQ (kind, Qswitch_frame)) { @@ -4057,8 +4066,11 @@ read-key-sequence will always return a logical unit. Better ideas? */ - if (mock_input > t) - t = mock_input; + for (; t < mock_input; t++) + { + echo_char (keybuf[t]); + add_command_key (keybuf[t]); + } return t; }