diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2016-04-27 16:46:22 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2016-04-27 16:46:22 +0000 |
commit | cf40c11d50a2c324a876dfb14a0fbe7396224040 (patch) | |
tree | 71055bae69bc82988b03852df75cb44048832eae /usr.bin/tmux/tty-keys.c | |
parent | a509bc5c6a28911a860950e7bad14095a8d5c133 (diff) |
Apply backspace check after working out the actual key, so that M-BSpace
can work.
Diffstat (limited to 'usr.bin/tmux/tty-keys.c')
-rw-r--r-- | usr.bin/tmux/tty-keys.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/usr.bin/tmux/tty-keys.c b/usr.bin/tmux/tty-keys.c index 7d3cc489c29..277377eacf6 100644 --- a/usr.bin/tmux/tty-keys.c +++ b/usr.bin/tmux/tty-keys.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty-keys.c,v 1.87 2016/04/27 16:40:12 nicm Exp $ */ +/* $OpenBSD: tty-keys.c,v 1.88 2016/04/27 16:46:21 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -600,16 +600,6 @@ first_key: /* No longer key found, use the first character. */ key = (u_char)*buf; size = 1; - - /* - * Check for backspace key using termios VERASE - the terminfo - * kbs entry is extremely unreliable, so cannot be safely - * used. termios should have a better idea. - */ - bspace = tty->tio.c_cc[VERASE]; - if (bspace != _POSIX_VDISABLE && key == bspace) - key = KEYC_BSPACE; - goto complete_key; partial_key: @@ -642,6 +632,15 @@ partial_key: complete_key: log_debug("complete key %.*s %#llx", (int)size, buf, key); + /* + * Check for backspace key using termios VERASE - the terminfo + * kbs entry is extremely unreliable, so cannot be safely + * used. termios should have a better idea. + */ + bspace = tty->tio.c_cc[VERASE]; + if (bspace != _POSIX_VDISABLE && (key & KEYC_MASK_KEY) == bspace) + key = (key & KEYC_MASK_MOD) | KEYC_BSPACE; + /* Remove data from buffer. */ evbuffer_drain(tty->event->input, size); |