Rename KEYC_ESCAPE to KEYC_META.

This commit is contained in:
Nicholas Marriott 2020-05-15 11:24:30 +01:00
parent 2cf967ee67
commit 031d4864a9
7 changed files with 74 additions and 74 deletions

View File

@ -335,12 +335,12 @@ static const key_code input_key_modifiers[] = {
0, 0,
0, 0,
KEYC_SHIFT|KEYC_XTERM, KEYC_SHIFT|KEYC_XTERM,
KEYC_ESCAPE|KEYC_XTERM, KEYC_META|KEYC_XTERM,
KEYC_SHIFT|KEYC_ESCAPE|KEYC_XTERM, KEYC_SHIFT|KEYC_META|KEYC_XTERM,
KEYC_CTRL|KEYC_XTERM, KEYC_CTRL|KEYC_XTERM,
KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM, KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM,
KEYC_ESCAPE|KEYC_CTRL|KEYC_XTERM, KEYC_META|KEYC_CTRL|KEYC_XTERM,
KEYC_SHIFT|KEYC_ESCAPE|KEYC_CTRL|KEYC_XTERM KEYC_SHIFT|KEYC_META|KEYC_CTRL|KEYC_XTERM
}; };
/* Input key comparison function. */ /* Input key comparison function. */
@ -448,9 +448,9 @@ input_key(struct screen *s, struct bufferevent *bev, key_code key)
* If this is a normal 7-bit key, just send it, with a leading escape * If this is a normal 7-bit key, just send it, with a leading escape
* if necessary. If it is a UTF-8 key, split it and send it. * if necessary. If it is a UTF-8 key, split it and send it.
*/ */
justkey = (key & ~(KEYC_XTERM|KEYC_ESCAPE)); justkey = (key & ~(KEYC_XTERM|KEYC_META));
if (justkey <= 0x7f) { if (justkey <= 0x7f) {
if (key & KEYC_ESCAPE) if (key & KEYC_META)
bufferevent_write(bev, "\033", 1); bufferevent_write(bev, "\033", 1);
ud.data[0] = justkey; ud.data[0] = justkey;
bufferevent_write(bev, &ud.data[0], 1); bufferevent_write(bev, &ud.data[0], 1);
@ -459,7 +459,7 @@ input_key(struct screen *s, struct bufferevent *bev, key_code key)
if (justkey > 0x7f && justkey < KEYC_BASE) { if (justkey > 0x7f && justkey < KEYC_BASE) {
if (utf8_split(justkey, &ud) != UTF8_DONE) if (utf8_split(justkey, &ud) != UTF8_DONE)
return (-1); return (-1);
if (key & KEYC_ESCAPE) if (key & KEYC_META)
bufferevent_write(bev, "\033", 1); bufferevent_write(bev, "\033", 1);
bufferevent_write(bev, ud.data, ud.size); bufferevent_write(bev, ud.data, ud.size);
return (0); return (0);
@ -482,7 +482,7 @@ input_key(struct screen *s, struct bufferevent *bev, key_code key)
log_debug("found key 0x%llx: \"%s\"", key, ike->data); log_debug("found key 0x%llx: \"%s\"", key, ike->data);
/* Prefix a \033 for escape. */ /* Prefix a \033 for escape. */
if (key & KEYC_ESCAPE) if (key & KEYC_META)
bufferevent_write(bev, "\033", 1); bufferevent_write(bev, "\033", 1);
bufferevent_write(bev, ike->data, datalen); bufferevent_write(bev, ike->data, datalen);
return (0); return (0);

View File

@ -143,7 +143,7 @@ key_string_get_modifiers(const char **string)
break; break;
case 'M': case 'M':
case 'm': case 'm':
modifiers |= KEYC_ESCAPE; modifiers |= KEYC_META;
break; break;
case 'S': case 'S':
case 's': case 's':
@ -265,7 +265,7 @@ key_string_lookup_key(key_code key)
/* Fill in the modifiers. */ /* Fill in the modifiers. */
if (key & KEYC_CTRL) if (key & KEYC_CTRL)
strlcat(out, "C-", sizeof out); strlcat(out, "C-", sizeof out);
if (key & KEYC_ESCAPE) if (key & KEYC_META)
strlcat(out, "M-", sizeof out); strlcat(out, "M-", sizeof out);
if (key & KEYC_SHIFT) if (key & KEYC_SHIFT)
strlcat(out, "S-", sizeof out); strlcat(out, "S-", sizeof out);

View File

@ -987,7 +987,7 @@ mode_tree_key(struct mode_tree_data *mtd, struct client *c, key_code *key,
choice = -1; choice = -1;
if (*key >= '0' && *key <= '9') if (*key >= '0' && *key <= '9')
choice = (*key) - '0'; choice = (*key) - '0';
else if (((*key) & KEYC_MASK_MOD) == KEYC_ESCAPE) { else if (((*key) & KEYC_MASK_MOD) == KEYC_META) {
tmp = (*key) & KEYC_MASK_KEY; tmp = (*key) & KEYC_MASK_KEY;
if (tmp >= 'a' && tmp <= 'z') if (tmp >= 'a' && tmp <= 'z')
choice = 10 + (tmp - 'a'); choice = 10 + (tmp - 'a');
@ -1111,12 +1111,12 @@ mode_tree_key(struct mode_tree_data *mtd, struct client *c, key_code *key,
mode_tree_build(mtd); mode_tree_build(mtd);
} }
break; break;
case '-'|KEYC_ESCAPE: case '-'|KEYC_META:
TAILQ_FOREACH(mti, &mtd->children, entry) TAILQ_FOREACH(mti, &mtd->children, entry)
mti->expanded = 0; mti->expanded = 0;
mode_tree_build(mtd); mode_tree_build(mtd);
break; break;
case '+'|KEYC_ESCAPE: case '+'|KEYC_META:
TAILQ_FOREACH(mti, &mtd->children, entry) TAILQ_FOREACH(mti, &mtd->children, entry)
mti->expanded = 1; mti->expanded = 1;
mode_tree_build(mtd); mode_tree_build(mtd);

View File

@ -1033,7 +1033,7 @@ have_event:
out: out:
/* Apply modifiers if any. */ /* Apply modifiers if any. */
if (b & MOUSE_MASK_META) if (b & MOUSE_MASK_META)
key |= KEYC_ESCAPE; key |= KEYC_META;
if (b & MOUSE_MASK_CTRL) if (b & MOUSE_MASK_CTRL)
key |= KEYC_CTRL; key |= KEYC_CTRL;
if (b & MOUSE_MASK_SHIFT) if (b & MOUSE_MASK_SHIFT)

View File

@ -827,7 +827,7 @@ status_prompt_translate_key(struct client *c, key_code key, key_code *new_key)
return (1); return (1);
case 'b': case 'b':
case 'B': case 'B':
*new_key = 'b'|KEYC_ESCAPE; *new_key = 'b'|KEYC_META;
return (1); return (1);
case 'd': case 'd':
*new_key = '\025'; *new_key = '\025';
@ -836,7 +836,7 @@ status_prompt_translate_key(struct client *c, key_code key, key_code *new_key)
case 'E': case 'E':
case 'w': case 'w':
case 'W': case 'W':
*new_key = 'f'|KEYC_ESCAPE; *new_key = 'f'|KEYC_META;
return (1); return (1);
case 'p': case 'p':
*new_key = '\031'; /* C-y */ *new_key = '\031'; /* C-y */
@ -1158,7 +1158,7 @@ process_key:
c->prompt_index = idx; c->prompt_index = idx;
goto changed; goto changed;
case 'f'|KEYC_ESCAPE: case 'f'|KEYC_META:
case KEYC_RIGHT|KEYC_CTRL: case KEYC_RIGHT|KEYC_CTRL:
ws = options_get_string(oo, "word-separators"); ws = options_get_string(oo, "word-separators");
@ -1182,7 +1182,7 @@ process_key:
c->prompt_index--; c->prompt_index--;
goto changed; goto changed;
case 'b'|KEYC_ESCAPE: case 'b'|KEYC_META:
case KEYC_LEFT|KEYC_CTRL: case KEYC_LEFT|KEYC_CTRL:
ws = options_get_string(oo, "word-separators"); ws = options_get_string(oo, "word-separators");

2
tmux.h
View File

@ -120,7 +120,7 @@ struct winlink;
#define KEYC_USER 0x0002000000000ULL #define KEYC_USER 0x0002000000000ULL
/* Key modifier bits. */ /* Key modifier bits. */
#define KEYC_ESCAPE 0x0100000000000ULL #define KEYC_META 0x0100000000000ULL
#define KEYC_CTRL 0x0200000000000ULL #define KEYC_CTRL 0x0200000000000ULL
#define KEYC_SHIFT 0x0400000000000ULL #define KEYC_SHIFT 0x0400000000000ULL
#define KEYC_XTERM 0x0800000000000ULL #define KEYC_XTERM 0x0800000000000ULL

View File

@ -226,12 +226,12 @@ static const key_code tty_default_xterm_modifiers[] = {
0, 0,
0, 0,
KEYC_SHIFT|KEYC_XTERM, KEYC_SHIFT|KEYC_XTERM,
KEYC_ESCAPE|KEYC_XTERM, KEYC_META|KEYC_XTERM,
KEYC_SHIFT|KEYC_ESCAPE|KEYC_XTERM, KEYC_SHIFT|KEYC_META|KEYC_XTERM,
KEYC_CTRL|KEYC_XTERM, KEYC_CTRL|KEYC_XTERM,
KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM, KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM,
KEYC_ESCAPE|KEYC_CTRL|KEYC_XTERM, KEYC_META|KEYC_CTRL|KEYC_XTERM,
KEYC_SHIFT|KEYC_ESCAPE|KEYC_CTRL|KEYC_XTERM KEYC_SHIFT|KEYC_META|KEYC_CTRL|KEYC_XTERM
}; };
/* /*
@ -297,22 +297,22 @@ static const struct tty_default_key_code tty_default_code_keys[] = {
{ TTYC_KF47, KEYC_F11|KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM }, { TTYC_KF47, KEYC_F11|KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM },
{ TTYC_KF48, KEYC_F12|KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM }, { TTYC_KF48, KEYC_F12|KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM },
{ TTYC_KF49, KEYC_F1|KEYC_ESCAPE|KEYC_XTERM }, { TTYC_KF49, KEYC_F1|KEYC_META|KEYC_XTERM },
{ TTYC_KF50, KEYC_F2|KEYC_ESCAPE|KEYC_XTERM }, { TTYC_KF50, KEYC_F2|KEYC_META|KEYC_XTERM },
{ TTYC_KF51, KEYC_F3|KEYC_ESCAPE|KEYC_XTERM }, { TTYC_KF51, KEYC_F3|KEYC_META|KEYC_XTERM },
{ TTYC_KF52, KEYC_F4|KEYC_ESCAPE|KEYC_XTERM }, { TTYC_KF52, KEYC_F4|KEYC_META|KEYC_XTERM },
{ TTYC_KF53, KEYC_F5|KEYC_ESCAPE|KEYC_XTERM }, { TTYC_KF53, KEYC_F5|KEYC_META|KEYC_XTERM },
{ TTYC_KF54, KEYC_F6|KEYC_ESCAPE|KEYC_XTERM }, { TTYC_KF54, KEYC_F6|KEYC_META|KEYC_XTERM },
{ TTYC_KF55, KEYC_F7|KEYC_ESCAPE|KEYC_XTERM }, { TTYC_KF55, KEYC_F7|KEYC_META|KEYC_XTERM },
{ TTYC_KF56, KEYC_F8|KEYC_ESCAPE|KEYC_XTERM }, { TTYC_KF56, KEYC_F8|KEYC_META|KEYC_XTERM },
{ TTYC_KF57, KEYC_F9|KEYC_ESCAPE|KEYC_XTERM }, { TTYC_KF57, KEYC_F9|KEYC_META|KEYC_XTERM },
{ TTYC_KF58, KEYC_F10|KEYC_ESCAPE|KEYC_XTERM }, { TTYC_KF58, KEYC_F10|KEYC_META|KEYC_XTERM },
{ TTYC_KF59, KEYC_F11|KEYC_ESCAPE|KEYC_XTERM }, { TTYC_KF59, KEYC_F11|KEYC_META|KEYC_XTERM },
{ TTYC_KF60, KEYC_F12|KEYC_ESCAPE|KEYC_XTERM }, { TTYC_KF60, KEYC_F12|KEYC_META|KEYC_XTERM },
{ TTYC_KF61, KEYC_F1|KEYC_ESCAPE|KEYC_SHIFT|KEYC_XTERM }, { TTYC_KF61, KEYC_F1|KEYC_META|KEYC_SHIFT|KEYC_XTERM },
{ TTYC_KF62, KEYC_F2|KEYC_ESCAPE|KEYC_SHIFT|KEYC_XTERM }, { TTYC_KF62, KEYC_F2|KEYC_META|KEYC_SHIFT|KEYC_XTERM },
{ TTYC_KF63, KEYC_F3|KEYC_ESCAPE|KEYC_SHIFT|KEYC_XTERM }, { TTYC_KF63, KEYC_F3|KEYC_META|KEYC_SHIFT|KEYC_XTERM },
{ TTYC_KICH1, KEYC_IC }, { TTYC_KICH1, KEYC_IC },
{ TTYC_KDCH1, KEYC_DC }, { TTYC_KDCH1, KEYC_DC },
@ -330,67 +330,67 @@ static const struct tty_default_key_code tty_default_code_keys[] = {
/* Key and modifier capabilities. */ /* Key and modifier capabilities. */
{ TTYC_KDC2, KEYC_DC|KEYC_SHIFT|KEYC_XTERM }, { TTYC_KDC2, KEYC_DC|KEYC_SHIFT|KEYC_XTERM },
{ TTYC_KDC3, KEYC_DC|KEYC_ESCAPE|KEYC_XTERM }, { TTYC_KDC3, KEYC_DC|KEYC_META|KEYC_XTERM },
{ TTYC_KDC4, KEYC_DC|KEYC_SHIFT|KEYC_ESCAPE|KEYC_XTERM }, { TTYC_KDC4, KEYC_DC|KEYC_SHIFT|KEYC_META|KEYC_XTERM },
{ TTYC_KDC5, KEYC_DC|KEYC_CTRL|KEYC_XTERM }, { TTYC_KDC5, KEYC_DC|KEYC_CTRL|KEYC_XTERM },
{ TTYC_KDC6, KEYC_DC|KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM }, { TTYC_KDC6, KEYC_DC|KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM },
{ TTYC_KDC7, KEYC_DC|KEYC_ESCAPE|KEYC_CTRL|KEYC_XTERM }, { TTYC_KDC7, KEYC_DC|KEYC_META|KEYC_CTRL|KEYC_XTERM },
{ TTYC_KIND, KEYC_DOWN|KEYC_SHIFT|KEYC_XTERM }, { TTYC_KIND, KEYC_DOWN|KEYC_SHIFT|KEYC_XTERM },
{ TTYC_KDN2, KEYC_DOWN|KEYC_SHIFT|KEYC_XTERM }, { TTYC_KDN2, KEYC_DOWN|KEYC_SHIFT|KEYC_XTERM },
{ TTYC_KDN3, KEYC_DOWN|KEYC_ESCAPE|KEYC_XTERM }, { TTYC_KDN3, KEYC_DOWN|KEYC_META|KEYC_XTERM },
{ TTYC_KDN4, KEYC_DOWN|KEYC_SHIFT|KEYC_ESCAPE|KEYC_XTERM }, { TTYC_KDN4, KEYC_DOWN|KEYC_SHIFT|KEYC_META|KEYC_XTERM },
{ TTYC_KDN5, KEYC_DOWN|KEYC_CTRL|KEYC_XTERM }, { TTYC_KDN5, KEYC_DOWN|KEYC_CTRL|KEYC_XTERM },
{ TTYC_KDN6, KEYC_DOWN|KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM }, { TTYC_KDN6, KEYC_DOWN|KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM },
{ TTYC_KDN7, KEYC_DOWN|KEYC_ESCAPE|KEYC_CTRL|KEYC_XTERM }, { TTYC_KDN7, KEYC_DOWN|KEYC_META|KEYC_CTRL|KEYC_XTERM },
{ TTYC_KEND2, KEYC_END|KEYC_SHIFT|KEYC_XTERM }, { TTYC_KEND2, KEYC_END|KEYC_SHIFT|KEYC_XTERM },
{ TTYC_KEND3, KEYC_END|KEYC_ESCAPE|KEYC_XTERM }, { TTYC_KEND3, KEYC_END|KEYC_META|KEYC_XTERM },
{ TTYC_KEND4, KEYC_END|KEYC_SHIFT|KEYC_ESCAPE|KEYC_XTERM }, { TTYC_KEND4, KEYC_END|KEYC_SHIFT|KEYC_META|KEYC_XTERM },
{ TTYC_KEND5, KEYC_END|KEYC_CTRL|KEYC_XTERM }, { TTYC_KEND5, KEYC_END|KEYC_CTRL|KEYC_XTERM },
{ TTYC_KEND6, KEYC_END|KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM }, { TTYC_KEND6, KEYC_END|KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM },
{ TTYC_KEND7, KEYC_END|KEYC_ESCAPE|KEYC_CTRL|KEYC_XTERM }, { TTYC_KEND7, KEYC_END|KEYC_META|KEYC_CTRL|KEYC_XTERM },
{ TTYC_KHOM2, KEYC_HOME|KEYC_SHIFT|KEYC_XTERM }, { TTYC_KHOM2, KEYC_HOME|KEYC_SHIFT|KEYC_XTERM },
{ TTYC_KHOM3, KEYC_HOME|KEYC_ESCAPE|KEYC_XTERM }, { TTYC_KHOM3, KEYC_HOME|KEYC_META|KEYC_XTERM },
{ TTYC_KHOM4, KEYC_HOME|KEYC_SHIFT|KEYC_ESCAPE|KEYC_XTERM }, { TTYC_KHOM4, KEYC_HOME|KEYC_SHIFT|KEYC_META|KEYC_XTERM },
{ TTYC_KHOM5, KEYC_HOME|KEYC_CTRL|KEYC_XTERM }, { TTYC_KHOM5, KEYC_HOME|KEYC_CTRL|KEYC_XTERM },
{ TTYC_KHOM6, KEYC_HOME|KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM }, { TTYC_KHOM6, KEYC_HOME|KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM },
{ TTYC_KHOM7, KEYC_HOME|KEYC_ESCAPE|KEYC_CTRL|KEYC_XTERM }, { TTYC_KHOM7, KEYC_HOME|KEYC_META|KEYC_CTRL|KEYC_XTERM },
{ TTYC_KIC2, KEYC_IC|KEYC_SHIFT|KEYC_XTERM }, { TTYC_KIC2, KEYC_IC|KEYC_SHIFT|KEYC_XTERM },
{ TTYC_KIC3, KEYC_IC|KEYC_ESCAPE|KEYC_XTERM }, { TTYC_KIC3, KEYC_IC|KEYC_META|KEYC_XTERM },
{ TTYC_KIC4, KEYC_IC|KEYC_SHIFT|KEYC_ESCAPE|KEYC_XTERM }, { TTYC_KIC4, KEYC_IC|KEYC_SHIFT|KEYC_META|KEYC_XTERM },
{ TTYC_KIC5, KEYC_IC|KEYC_CTRL|KEYC_XTERM }, { TTYC_KIC5, KEYC_IC|KEYC_CTRL|KEYC_XTERM },
{ TTYC_KIC6, KEYC_IC|KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM }, { TTYC_KIC6, KEYC_IC|KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM },
{ TTYC_KIC7, KEYC_IC|KEYC_ESCAPE|KEYC_CTRL|KEYC_XTERM }, { TTYC_KIC7, KEYC_IC|KEYC_META|KEYC_CTRL|KEYC_XTERM },
{ TTYC_KLFT2, KEYC_LEFT|KEYC_SHIFT|KEYC_XTERM }, { TTYC_KLFT2, KEYC_LEFT|KEYC_SHIFT|KEYC_XTERM },
{ TTYC_KLFT3, KEYC_LEFT|KEYC_ESCAPE|KEYC_XTERM }, { TTYC_KLFT3, KEYC_LEFT|KEYC_META|KEYC_XTERM },
{ TTYC_KLFT4, KEYC_LEFT|KEYC_SHIFT|KEYC_ESCAPE|KEYC_XTERM }, { TTYC_KLFT4, KEYC_LEFT|KEYC_SHIFT|KEYC_META|KEYC_XTERM },
{ TTYC_KLFT5, KEYC_LEFT|KEYC_CTRL|KEYC_XTERM }, { TTYC_KLFT5, KEYC_LEFT|KEYC_CTRL|KEYC_XTERM },
{ TTYC_KLFT6, KEYC_LEFT|KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM }, { TTYC_KLFT6, KEYC_LEFT|KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM },
{ TTYC_KLFT7, KEYC_LEFT|KEYC_ESCAPE|KEYC_CTRL|KEYC_XTERM }, { TTYC_KLFT7, KEYC_LEFT|KEYC_META|KEYC_CTRL|KEYC_XTERM },
{ TTYC_KNXT2, KEYC_NPAGE|KEYC_SHIFT|KEYC_XTERM }, { TTYC_KNXT2, KEYC_NPAGE|KEYC_SHIFT|KEYC_XTERM },
{ TTYC_KNXT3, KEYC_NPAGE|KEYC_ESCAPE|KEYC_XTERM }, { TTYC_KNXT3, KEYC_NPAGE|KEYC_META|KEYC_XTERM },
{ TTYC_KNXT4, KEYC_NPAGE|KEYC_SHIFT|KEYC_ESCAPE|KEYC_XTERM }, { TTYC_KNXT4, KEYC_NPAGE|KEYC_SHIFT|KEYC_META|KEYC_XTERM },
{ TTYC_KNXT5, KEYC_NPAGE|KEYC_CTRL|KEYC_XTERM }, { TTYC_KNXT5, KEYC_NPAGE|KEYC_CTRL|KEYC_XTERM },
{ TTYC_KNXT6, KEYC_NPAGE|KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM }, { TTYC_KNXT6, KEYC_NPAGE|KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM },
{ TTYC_KNXT7, KEYC_NPAGE|KEYC_ESCAPE|KEYC_CTRL|KEYC_XTERM }, { TTYC_KNXT7, KEYC_NPAGE|KEYC_META|KEYC_CTRL|KEYC_XTERM },
{ TTYC_KPRV2, KEYC_PPAGE|KEYC_SHIFT|KEYC_XTERM }, { TTYC_KPRV2, KEYC_PPAGE|KEYC_SHIFT|KEYC_XTERM },
{ TTYC_KPRV3, KEYC_PPAGE|KEYC_ESCAPE|KEYC_XTERM }, { TTYC_KPRV3, KEYC_PPAGE|KEYC_META|KEYC_XTERM },
{ TTYC_KPRV4, KEYC_PPAGE|KEYC_SHIFT|KEYC_ESCAPE|KEYC_XTERM }, { TTYC_KPRV4, KEYC_PPAGE|KEYC_SHIFT|KEYC_META|KEYC_XTERM },
{ TTYC_KPRV5, KEYC_PPAGE|KEYC_CTRL|KEYC_XTERM }, { TTYC_KPRV5, KEYC_PPAGE|KEYC_CTRL|KEYC_XTERM },
{ TTYC_KPRV6, KEYC_PPAGE|KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM }, { TTYC_KPRV6, KEYC_PPAGE|KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM },
{ TTYC_KPRV7, KEYC_PPAGE|KEYC_ESCAPE|KEYC_CTRL|KEYC_XTERM }, { TTYC_KPRV7, KEYC_PPAGE|KEYC_META|KEYC_CTRL|KEYC_XTERM },
{ TTYC_KRIT2, KEYC_RIGHT|KEYC_SHIFT|KEYC_XTERM }, { TTYC_KRIT2, KEYC_RIGHT|KEYC_SHIFT|KEYC_XTERM },
{ TTYC_KRIT3, KEYC_RIGHT|KEYC_ESCAPE|KEYC_XTERM }, { TTYC_KRIT3, KEYC_RIGHT|KEYC_META|KEYC_XTERM },
{ TTYC_KRIT4, KEYC_RIGHT|KEYC_SHIFT|KEYC_ESCAPE|KEYC_XTERM }, { TTYC_KRIT4, KEYC_RIGHT|KEYC_SHIFT|KEYC_META|KEYC_XTERM },
{ TTYC_KRIT5, KEYC_RIGHT|KEYC_CTRL|KEYC_XTERM }, { TTYC_KRIT5, KEYC_RIGHT|KEYC_CTRL|KEYC_XTERM },
{ TTYC_KRIT6, KEYC_RIGHT|KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM }, { TTYC_KRIT6, KEYC_RIGHT|KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM },
{ TTYC_KRIT7, KEYC_RIGHT|KEYC_ESCAPE|KEYC_CTRL|KEYC_XTERM }, { TTYC_KRIT7, KEYC_RIGHT|KEYC_META|KEYC_CTRL|KEYC_XTERM },
{ TTYC_KRI, KEYC_UP|KEYC_SHIFT|KEYC_XTERM }, { TTYC_KRI, KEYC_UP|KEYC_SHIFT|KEYC_XTERM },
{ TTYC_KUP2, KEYC_UP|KEYC_SHIFT|KEYC_XTERM }, { TTYC_KUP2, KEYC_UP|KEYC_SHIFT|KEYC_XTERM },
{ TTYC_KUP3, KEYC_UP|KEYC_ESCAPE|KEYC_XTERM }, { TTYC_KUP3, KEYC_UP|KEYC_META|KEYC_XTERM },
{ TTYC_KUP4, KEYC_UP|KEYC_SHIFT|KEYC_ESCAPE|KEYC_XTERM }, { TTYC_KUP4, KEYC_UP|KEYC_SHIFT|KEYC_META|KEYC_XTERM },
{ TTYC_KUP5, KEYC_UP|KEYC_CTRL|KEYC_XTERM }, { TTYC_KUP5, KEYC_UP|KEYC_CTRL|KEYC_XTERM },
{ TTYC_KUP6, KEYC_UP|KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM }, { TTYC_KUP6, KEYC_UP|KEYC_SHIFT|KEYC_CTRL|KEYC_XTERM },
{ TTYC_KUP7, KEYC_UP|KEYC_ESCAPE|KEYC_CTRL|KEYC_XTERM }, { TTYC_KUP7, KEYC_UP|KEYC_META|KEYC_CTRL|KEYC_XTERM },
}; };
/* Add key to tree. */ /* Add key to tree. */
@ -731,7 +731,7 @@ first_key:
size = 1; size = 1;
goto complete_key; goto complete_key;
} }
key |= KEYC_ESCAPE; key |= KEYC_META;
size++; size++;
goto complete_key; goto complete_key;
} }
@ -744,7 +744,7 @@ first_key:
* escape). So pass it through even if the timer has not expired. * escape). So pass it through even if the timer has not expired.
*/ */
if (*buf == '\033' && len >= 2) { if (*buf == '\033' && len >= 2) {
key = (u_char)buf[1] | KEYC_ESCAPE; key = (u_char)buf[1] | KEYC_META;
size = 2; size = 2;
} else { } else {
key = (u_char)buf[0]; key = (u_char)buf[0];
@ -902,10 +902,10 @@ tty_keys_extended_key(struct tty *tty, const char *buf, size_t len,
(*key) |= KEYC_SHIFT; (*key) |= KEYC_SHIFT;
break; break;
case 3: case 3:
(*key) |= KEYC_ESCAPE; (*key) |= KEYC_META;
break; break;
case 4: case 4:
(*key) |= (KEYC_SHIFT|KEYC_ESCAPE); (*key) |= (KEYC_SHIFT|KEYC_META);
break; break;
case 5: case 5:
(*key) |= KEYC_CTRL; (*key) |= KEYC_CTRL;
@ -914,10 +914,10 @@ tty_keys_extended_key(struct tty *tty, const char *buf, size_t len,
(*key) |= (KEYC_SHIFT|KEYC_CTRL); (*key) |= (KEYC_SHIFT|KEYC_CTRL);
break; break;
case 7: case 7:
(*key) |= (KEYC_ESCAPE|KEYC_CTRL); (*key) |= (KEYC_META|KEYC_CTRL);
break; break;
case 8: case 8:
(*key) |= (KEYC_SHIFT|KEYC_ESCAPE|KEYC_CTRL); (*key) |= (KEYC_SHIFT|KEYC_META|KEYC_CTRL);
break; break;
default: default:
*key = KEYC_NONE; *key = KEYC_NONE;