diff options
author | Thomas Adam <thomas@xteddy.org> | 2017-05-09 15:44:13 +0100 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2017-05-09 15:44:13 +0100 |
commit | a651b08a2f95bb206ae6385801518f93fdd5000e (patch) | |
tree | be8f2f1c33014e8524738174b54a967ab9fde362 /xterm-keys.c | |
parent | f3221941f27dbe4dbee550f72d42f268c228f5d1 (diff) | |
parent | 18f36906a9e40ebcf9705fa9deb197bc4a1f813a (diff) | |
download | rtmux-a651b08a2f95bb206ae6385801518f93fdd5000e.tar.gz rtmux-a651b08a2f95bb206ae6385801518f93fdd5000e.tar.bz2 rtmux-a651b08a2f95bb206ae6385801518f93fdd5000e.zip |
Merge branch 'obsd-master'
Conflicts:
format.c
Diffstat (limited to 'xterm-keys.c')
-rw-r--r-- | xterm-keys.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/xterm-keys.c b/xterm-keys.c index 5ffc845f..b10c10db 100644 --- a/xterm-keys.c +++ b/xterm-keys.c @@ -197,7 +197,7 @@ xterm_keys_find(const char *buf, size_t len, size_t *size, key_code *key) if (matched == -1) continue; if (matched == 0) - *key = entry->key | modifiers; + *key = (entry->key|modifiers|KEYC_XTERM); return (matched); } return (-1); @@ -227,8 +227,16 @@ xterm_keys_lookup(key_code key) if (modifiers == 1) return (NULL); + /* + * If this has the escape modifier, but was not originally an xterm + * key, it may be a genuine escape + key. So don't pass it through as + * an xterm key or programs like vi may be confused. + */ + if ((key & (KEYC_ESCAPE|KEYC_XTERM)) == KEYC_ESCAPE) + return (NULL); + /* Otherwise, find the key in the table. */ - key &= ~(KEYC_SHIFT|KEYC_ESCAPE|KEYC_CTRL); + key &= KEYC_MASK_KEY; for (i = 0; i < nitems(xterm_keys_table); i++) { entry = &xterm_keys_table[i]; if (key == entry->key) |