]> git.eshelyaron.com Git - emacs.git/commitdiff
Replay key if kboard is interrupted while initializing (Bug#37782)
authormemeplex <carlosjosepita@gmail.com>
Sat, 19 Oct 2019 03:13:15 +0000 (00:13 -0300)
committerEli Zaretskii <eliz@gnu.org>
Sat, 26 Oct 2019 10:29:29 +0000 (13:29 +0300)
The problem with the original fix for bug#5095 is that it drops
the current event, which is a valid character event and not -2.
Thus, the first ESC character sent by the terminal after turning
on focus tracking is lost and we get '[' and 'I' events separately
inserted into the buffer afterwards.

* src/keyboard.c (read_key_sequence): Add key as mock_input and replay
sequence using new keyboard, when the key is not -2.

src/keyboard.c

index 56ab79068ad48887406c64df672e1b97a3f83a04..0eab8fdfae1734481e2b5a255c2dc6c6d9ae2455 100644 (file)
@@ -9596,7 +9596,16 @@ read_key_sequence (Lisp_Object *keybuf, Lisp_Object prompt,
                       Fcons (make_lispy_switch_frame (frame),
                              KVAR (interrupted_kboard, kbd_queue)));
                  }
-               mock_input = 0;
+                if (FIXNUMP (key) && XFIXNUM (key) == -2)
+                  mock_input = 0;
+                else
+                  {
+                    /* If interrupted while initializing terminal, we
+                       need to replay the interrupting key.  See
+                       Bug#5095 and Bug#37782.  */
+                    mock_input = 1;
+                    keybuf[0] = key;
+                  }
                goto replay_entire_sequence;
              }
          }