diff options
author | Jim Blandy <jimb@redhat.com> | 1993-06-17 21:23:29 +0000 |
---|---|---|
committer | Jim Blandy <jimb@redhat.com> | 1993-06-17 21:23:29 +0000 |
commit | cca310dacfa95c43da82eb74136c56ad285fc33b (patch) | |
tree | 8497029834b06462866beddecfa85a2da304227c /src | |
parent | e66feb07ede03b7f6c428ba1eb85347674f2b759 (diff) | |
download | emacs-cca310dacfa95c43da82eb74136c56ad285fc33b.tar.gz |
* 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.c | 52 |
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) 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 @@ read_key_sequence (keybuf, bufsize, prompt) 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 @@ read_key_sequence (keybuf, bufsize, prompt) && 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 @@ read_key_sequence (keybuf, bufsize, prompt) 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 (keybuf, bufsize, prompt) 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; } |