=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/tty-keys.c,v retrieving revision 1.58 retrieving revision 1.59 diff -u -r1.58 -r1.59 --- src/usr.bin/tmux/tty-keys.c 2013/03/25 11:44:16 1.58 +++ src/usr.bin/tmux/tty-keys.c 2013/03/26 14:14:08 1.59 @@ -1,4 +1,4 @@ -/* $OpenBSD: tty-keys.c,v 1.58 2013/03/25 11:44:16 nicm Exp $ */ +/* $OpenBSD: tty-keys.c,v 1.59 2013/03/26 14:14:08 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -448,7 +448,7 @@ const char *buf; size_t len, size; cc_t bspace; - int key, delay; + int key, delay, expired = 0; /* Get key buffer. */ buf = EVBUFFER_DATA(tty->event->input); @@ -508,7 +508,7 @@ } tk = tty_keys_find(tty, buf + 1, len - 1, &size); - if (tk != NULL) { + if (tk != NULL && (!expired || tk->next == NULL)) { size++; /* include escape */ if (tk->next != NULL) goto partial_key; @@ -540,8 +540,10 @@ /* If timer is going, check for expiration. */ if (tty->flags & TTY_TIMER) { if (evtimer_initialized(&tty->key_timer) && - !evtimer_pending(&tty->key_timer, NULL)) + !evtimer_pending(&tty->key_timer, NULL)) { + expired = 1; goto first_key; + } return (0); }