mirror of
https://github.com/tmux/tmux.git
synced 2025-01-07 16:28:48 +00:00
Only accept partial keys if the timer has not expired, fixes infinite
loop when Escape is pressed the wrong number of times.
This commit is contained in:
parent
771d7db3a6
commit
dfac36b6c3
@ -448,7 +448,7 @@ tty_keys_next(struct tty *tty)
|
|||||||
const char *buf;
|
const char *buf;
|
||||||
size_t len, size;
|
size_t len, size;
|
||||||
cc_t bspace;
|
cc_t bspace;
|
||||||
int key, delay;
|
int key, delay, expired = 0;
|
||||||
|
|
||||||
/* Get key buffer. */
|
/* Get key buffer. */
|
||||||
buf = EVBUFFER_DATA(tty->event->input);
|
buf = EVBUFFER_DATA(tty->event->input);
|
||||||
@ -508,7 +508,7 @@ first_key:
|
|||||||
}
|
}
|
||||||
|
|
||||||
tk = tty_keys_find(tty, buf + 1, len - 1, &size);
|
tk = tty_keys_find(tty, buf + 1, len - 1, &size);
|
||||||
if (tk != NULL) {
|
if (tk != NULL && (!expired || tk->next == NULL)) {
|
||||||
size++; /* include escape */
|
size++; /* include escape */
|
||||||
if (tk->next != NULL)
|
if (tk->next != NULL)
|
||||||
goto partial_key;
|
goto partial_key;
|
||||||
@ -540,8 +540,10 @@ partial_key:
|
|||||||
/* If timer is going, check for expiration. */
|
/* If timer is going, check for expiration. */
|
||||||
if (tty->flags & TTY_TIMER) {
|
if (tty->flags & TTY_TIMER) {
|
||||||
if (evtimer_initialized(&tty->key_timer) &&
|
if (evtimer_initialized(&tty->key_timer) &&
|
||||||
!evtimer_pending(&tty->key_timer, NULL))
|
!evtimer_pending(&tty->key_timer, NULL)) {
|
||||||
|
expired = 1;
|
||||||
goto first_key;
|
goto first_key;
|
||||||
|
}
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user