=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/input-keys.c,v retrieving revision 1.56 retrieving revision 1.57 diff -u -r1.56 -r1.57 --- src/usr.bin/tmux/input-keys.c 2016/10/03 22:52:11 1.56 +++ src/usr.bin/tmux/input-keys.c 2017/01/25 14:24:54 1.57 @@ -1,4 +1,4 @@ -/* $OpenBSD: input-keys.c,v 1.56 2016/10/03 22:52:11 nicm Exp $ */ +/* $OpenBSD: input-keys.c,v 1.57 2017/01/25 14:24:54 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -158,6 +158,7 @@ char *out; key_code justkey; struct utf8_data ud; + int mode; log_debug("writing key 0x%llx (%s) to %%%u", key, key_string_lookup_key(key), wp->id); @@ -194,8 +195,9 @@ * Then try to look this up as an xterm key, if the flag to output them * is set. */ + mode = wp->screen->mode; if (options_get_number(wp->window->options, "xterm-keys")) { - if ((out = xterm_keys_lookup(key)) != NULL) { + if ((out = xterm_keys_lookup(key, mode)) != NULL) { bufferevent_write(wp->event, out, strlen(out)); free(out); return; @@ -206,11 +208,9 @@ for (i = 0; i < nitems(input_keys); i++) { ike = &input_keys[i]; - if ((ike->flags & INPUTKEY_KEYPAD) && - !(wp->screen->mode & MODE_KKEYPAD)) + if ((ike->flags & INPUTKEY_KEYPAD) && (~mode & MODE_KKEYPAD)) continue; - if ((ike->flags & INPUTKEY_CURSOR) && - !(wp->screen->mode & MODE_KCURSOR)) + if ((ike->flags & INPUTKEY_CURSOR) && (~mode & MODE_KCURSOR)) continue; if ((key & KEYC_ESCAPE) && (ike->key | KEYC_ESCAPE) == key)