diff options
author | Tiago Cunha <tcunha@gmx.com> | 2012-04-24 16:17:57 +0000 |
---|---|---|
committer | Tiago Cunha <tcunha@gmx.com> | 2012-04-24 16:17:57 +0000 |
commit | bdfbb5295169ee1b9341a0ef8f0f80185f1191db (patch) | |
tree | 245d48a3c501686da0c0365824ecf3e5c9b60308 /tty-keys.c | |
parent | e65c5ad56cdb2f44be271796d07f70b8b9d3e82c (diff) | |
download | rtmux-bdfbb5295169ee1b9341a0ef8f0f80185f1191db.tar.gz rtmux-bdfbb5295169ee1b9341a0ef8f0f80185f1191db.tar.bz2 rtmux-bdfbb5295169ee1b9341a0ef8f0f80185f1191db.zip |
Sync OpenBSD patchset 1094:
Handle partial keys properly by making sure the timer has actually
expired, fixes problems with mintty reported by Michael Simpson.
Diffstat (limited to 'tty-keys.c')
-rw-r--r-- | tty-keys.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -476,7 +476,6 @@ tty_keys_next(struct tty *tty) goto partial_key; } - /* Is this a mouse key press? */ switch (tty_keys_mouse(tty, buf, len, &size, &mouse)) { case 0: /* yes */ @@ -532,10 +531,11 @@ tty_keys_next(struct tty *tty) partial_key: /* - * Escape but no key string. If have already seen an escape, then the - * timer must have expired, so give up waiting and send the escape. + * Escape but no key string. If have already seen an escape and the + * timer has expired, give up waiting and send the escape. */ - if (tty->flags & TTY_ESCAPE) { + if ((tty->flags & TTY_ESCAPE) && + !evtimer_pending(&tty->key_timer, NULL)) { evbuffer_drain(tty->event->input, 1); key = '\033'; goto handle_key; @@ -544,6 +544,10 @@ partial_key: /* Fall through to start the timer. */ start_timer: + /* If already waiting for timer, do nothing. */ + if (evtimer_pending(&tty->key_timer, NULL)) + return (0); + /* Start the timer and wait for expiry or more data. */ delay = options_get_number(&global_options, "escape-time"); tv.tv_sec = delay / 1000; |