summaryrefslogtreecommitdiffstats
path: root/input-keys.c
diff options
context:
space:
mode:
authornicm <nicm>2017-01-25 14:24:54 +0000
committernicm <nicm>2017-01-25 14:24:54 +0000
commit0a63ab4f0f23c22f9328f672bb6af51758cde556 (patch)
tree0ea6dd33d13aec606094cbae4acb31d6728794fe /input-keys.c
parentffc28a7765f4b560427404c9679966232655e67e (diff)
If xterm-keys is on, use xterm(1) style keys for Home and End as well as
modified keys.
Diffstat (limited to 'input-keys.c')
-rw-r--r--input-keys.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/input-keys.c b/input-keys.c
index 767c5ca9..9225d8e2 100644
--- a/input-keys.c
+++ b/input-keys.c
@@ -158,6 +158,7 @@ input_key(struct window_pane *wp, key_code key, struct mouse_event *m)
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 @@ input_key(struct window_pane *wp, key_code key, struct mouse_event *m)
* 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 @@ input_key(struct window_pane *wp, key_code key, struct mouse_event *m)
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)