Now that glfw reports shifted keys, use it when encoding key events

This commit is contained in:
Kovid Goyal 2021-01-17 11:14:44 +05:30
parent 089d358031
commit 39da92d8ab
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 310 additions and 363 deletions

View File

@ -318,29 +318,23 @@ def generate_legacy_text_key_maps() -> None:
tp = ' ' * 8
shift, alt, ctrl = 1, 2, 4
lines = []
for c, s in shift_map.items():
if c in '\\\'':
c = '\\' + c
lines.append(f" case '{c}': return '{s}';")
patch_file('kitty/key_encoding.c', 'shifted key map', '\n'.join(lines))
def simple(c: str) -> None:
shifted = shift_map.get(c, c)
ctrled = chr(ctrl_mapping.get(c, ord(c)))
call = f'enc(ord({c!r}), shifted_key=ord({shifted!r})'
for m in range(16):
if m == 0:
tests.append(f'{tp}ae(enc(ord({c!r})), {c!r})')
tests.append(f'{tp}ae({call}), {c!r})')
elif m == shift:
tests.append(f'{tp}ae(enc(ord({c!r}), mods=shift), {shifted!r})')
tests.append(f'{tp}ae({call}, mods=shift), {shifted!r})')
elif m == alt:
tests.append(f'{tp}ae(enc(ord({c!r}), mods=alt), "\\x1b" + {c!r})')
tests.append(f'{tp}ae({call}, mods=alt), "\\x1b" + {c!r})')
elif m == ctrl:
tests.append(f'{tp}ae(enc(ord({c!r}), mods=ctrl), {ctrled!r})')
tests.append(f'{tp}ae({call}, mods=ctrl), {ctrled!r})')
elif m == shift | alt:
tests.append(f'{tp}ae(enc(ord({c!r}), mods=shift | alt), "\\x1b" + {shifted!r})')
tests.append(f'{tp}ae({call}, mods=shift | alt), "\\x1b" + {shifted!r})')
elif m == ctrl | alt:
tests.append(f'{tp}ae(enc(ord({c!r}), mods=ctrl | alt), "\\x1b" + {ctrled!r})')
tests.append(f'{tp}ae({call}, mods=ctrl | alt), "\\x1b" + {ctrled!r})')
for k in shift_map:
simple(k)

View File

@ -199,65 +199,8 @@ encode_function_key(const KeyEvent *ev, char *output) {
return serialize(&ed, output, csi_trailer);
}
static inline char
shifted_ascii_key(const uint32_t key) { // {{{
switch(key) {
/* start shifted key map (auto generated by gen-key-constants.py do not edit) */
case '`': return '~';
case '1': return '!';
case '2': return '@';
case '3': return '#';
case '4': return '$';
case '5': return '%';
case '6': return '^';
case '7': return '&';
case '8': return '*';
case '9': return '(';
case '0': return ')';
case '-': return '_';
case '=': return '+';
case '[': return '{';
case ']': return '}';
case '\\': return '|';
case ';': return ':';
case '\'': return '"';
case ',': return '<';
case '.': return '>';
case '/': return '?';
case 'a': return 'A';
case 'b': return 'B';
case 'c': return 'C';
case 'd': return 'D';
case 'e': return 'E';
case 'f': return 'F';
case 'g': return 'G';
case 'h': return 'H';
case 'i': return 'I';
case 'j': return 'J';
case 'k': return 'K';
case 'l': return 'L';
case 'm': return 'M';
case 'n': return 'N';
case 'o': return 'O';
case 'p': return 'P';
case 'q': return 'Q';
case 'r': return 'R';
case 's': return 'S';
case 't': return 'T';
case 'u': return 'U';
case 'v': return 'V';
case 'w': return 'W';
case 'x': return 'X';
case 'y': return 'Y';
case 'z': return 'Z';
/* end shifted key map */
default:
return key;
}
} // }}}
static char
ctrled_key(const uint32_t key) { // {{{
ctrled_key(const char key) { // {{{
switch(key) {
/* start ctrl mapping (auto generated by gen-key-constants.py do not edit) */
case ' ': return 0;
@ -315,17 +258,25 @@ ctrled_key(const uint32_t key) { // {{{
static int
encode_printable_ascii_key_legacy(const KeyEvent *ev, char *output) {
if (!ev->mods.value) return snprintf(output, KEY_BUFFER_SIZE, "%c", (char)ev->key);
if (ev->disambiguate) return 0;
char shifted_key = (ev->mods.shift) ? shifted_ascii_key(ev->key) : (char)ev->key;
char key = ev->key;
unsigned mods = ev->mods.value;
if (mods & SHIFT) {
const char shifted = ev->shifted_key;
if (shifted && shifted != key && (!(mods & CTRL) || key < 'a' || key > 'z')) {
key = shifted;
mods &= ~SHIFT;
}
}
if (ev->mods.value == SHIFT)
return snprintf(output, KEY_BUFFER_SIZE, "%c", shifted_key);
if ((ev->mods.value == ALT || ev->mods.value == (SHIFT | ALT)))
return snprintf(output, KEY_BUFFER_SIZE, "\x1b%c", shifted_key);
if (ev->mods.value == CTRL)
return snprintf(output, KEY_BUFFER_SIZE, "%c", ctrled_key(ev->key));
if (ev->mods.value == (CTRL | ALT))
return snprintf(output, KEY_BUFFER_SIZE, "\x1b%c", ctrled_key(ev->key));
return snprintf(output, KEY_BUFFER_SIZE, "%c", key);
if (mods == ALT)
return snprintf(output, KEY_BUFFER_SIZE, "\x1b%c", key);
if (mods == CTRL)
return snprintf(output, KEY_BUFFER_SIZE, "%c", ctrled_key(key));
if (mods == (CTRL | ALT))
return snprintf(output, KEY_BUFFER_SIZE, "\x1b%c", ctrled_key(key));
return 0;
}
@ -367,7 +318,7 @@ encode_key(const KeyEvent *ev, char *output) {
return encode_utf8(ev->key, output);
}
if (!ev->disambiguate && !ev->report_text) {
if (is_legacy_ascii_key(ev->key)) {
if (is_legacy_ascii_key(ev->key) || (ev->shifted_key && is_legacy_ascii_key(ev->shifted_key))) {
int ret = encode_printable_ascii_key_legacy(ev, output);
if (ret > 0) return ret;
} else if (ev->key == ' ' && ev->mods.value == CTRL) {
@ -378,6 +329,7 @@ encode_key(const KeyEvent *ev, char *output) {
KeyEvent alternate = *ev;
alternate.key = ev->alternate_key;
alternate.alternate_key = 0;
alternate.shifted_key = 0;
int ret = encode_printable_ascii_key_legacy(&alternate, output);
if (ret > 0) return ret;
}

View File

@ -106,291 +106,292 @@ class TestKeys(BaseTest):
# legacy key tests {{{
# start legacy letter tests (auto generated by gen-key-constants.py do not edit)
ae(enc(ord('`')), '`')
ae(enc(ord('`'), mods=shift), '~')
ae(enc(ord('`'), mods=alt), "\x1b" + '`')
ae(enc(ord('`'), mods=shift | alt), "\x1b" + '~')
ae(enc(ord('`'), mods=ctrl), '`')
ae(enc(ord('`'), mods=ctrl | alt), "\x1b" + '`')
ae(enc(ord('1')), '1')
ae(enc(ord('1'), mods=shift), '!')
ae(enc(ord('1'), mods=alt), "\x1b" + '1')
ae(enc(ord('1'), mods=shift | alt), "\x1b" + '!')
ae(enc(ord('1'), mods=ctrl), '1')
ae(enc(ord('1'), mods=ctrl | alt), "\x1b" + '1')
ae(enc(ord('2')), '2')
ae(enc(ord('2'), mods=shift), '@')
ae(enc(ord('2'), mods=alt), "\x1b" + '2')
ae(enc(ord('2'), mods=shift | alt), "\x1b" + '@')
ae(enc(ord('2'), mods=ctrl), '\x00')
ae(enc(ord('2'), mods=ctrl | alt), "\x1b" + '\x00')
ae(enc(ord('3')), '3')
ae(enc(ord('3'), mods=shift), '#')
ae(enc(ord('3'), mods=alt), "\x1b" + '3')
ae(enc(ord('3'), mods=shift | alt), "\x1b" + '#')
ae(enc(ord('3'), mods=ctrl), '\x1b')
ae(enc(ord('3'), mods=ctrl | alt), "\x1b" + '\x1b')
ae(enc(ord('4')), '4')
ae(enc(ord('4'), mods=shift), '$')
ae(enc(ord('4'), mods=alt), "\x1b" + '4')
ae(enc(ord('4'), mods=shift | alt), "\x1b" + '$')
ae(enc(ord('4'), mods=ctrl), '\x1c')
ae(enc(ord('4'), mods=ctrl | alt), "\x1b" + '\x1c')
ae(enc(ord('5')), '5')
ae(enc(ord('5'), mods=shift), '%')
ae(enc(ord('5'), mods=alt), "\x1b" + '5')
ae(enc(ord('5'), mods=shift | alt), "\x1b" + '%')
ae(enc(ord('5'), mods=ctrl), '\x1d')
ae(enc(ord('5'), mods=ctrl | alt), "\x1b" + '\x1d')
ae(enc(ord('6')), '6')
ae(enc(ord('6'), mods=shift), '^')
ae(enc(ord('6'), mods=alt), "\x1b" + '6')
ae(enc(ord('6'), mods=shift | alt), "\x1b" + '^')
ae(enc(ord('6'), mods=ctrl), '\x1e')
ae(enc(ord('6'), mods=ctrl | alt), "\x1b" + '\x1e')
ae(enc(ord('7')), '7')
ae(enc(ord('7'), mods=shift), '&')
ae(enc(ord('7'), mods=alt), "\x1b" + '7')
ae(enc(ord('7'), mods=shift | alt), "\x1b" + '&')
ae(enc(ord('7'), mods=ctrl), '\x1f')
ae(enc(ord('7'), mods=ctrl | alt), "\x1b" + '\x1f')
ae(enc(ord('8')), '8')
ae(enc(ord('8'), mods=shift), '*')
ae(enc(ord('8'), mods=alt), "\x1b" + '8')
ae(enc(ord('8'), mods=shift | alt), "\x1b" + '*')
ae(enc(ord('8'), mods=ctrl), '\x7f')
ae(enc(ord('8'), mods=ctrl | alt), "\x1b" + '\x7f')
ae(enc(ord('9')), '9')
ae(enc(ord('9'), mods=shift), '(')
ae(enc(ord('9'), mods=alt), "\x1b" + '9')
ae(enc(ord('9'), mods=shift | alt), "\x1b" + '(')
ae(enc(ord('9'), mods=ctrl), '9')
ae(enc(ord('9'), mods=ctrl | alt), "\x1b" + '9')
ae(enc(ord('0')), '0')
ae(enc(ord('0'), mods=shift), ')')
ae(enc(ord('0'), mods=alt), "\x1b" + '0')
ae(enc(ord('0'), mods=shift | alt), "\x1b" + ')')
ae(enc(ord('0'), mods=ctrl), '0')
ae(enc(ord('0'), mods=ctrl | alt), "\x1b" + '0')
ae(enc(ord('-')), '-')
ae(enc(ord('-'), mods=shift), '_')
ae(enc(ord('-'), mods=alt), "\x1b" + '-')
ae(enc(ord('-'), mods=shift | alt), "\x1b" + '_')
ae(enc(ord('-'), mods=ctrl), '-')
ae(enc(ord('-'), mods=ctrl | alt), "\x1b" + '-')
ae(enc(ord('=')), '=')
ae(enc(ord('='), mods=shift), '+')
ae(enc(ord('='), mods=alt), "\x1b" + '=')
ae(enc(ord('='), mods=shift | alt), "\x1b" + '+')
ae(enc(ord('='), mods=ctrl), '=')
ae(enc(ord('='), mods=ctrl | alt), "\x1b" + '=')
ae(enc(ord('[')), '[')
ae(enc(ord('['), mods=shift), '{')
ae(enc(ord('['), mods=alt), "\x1b" + '[')
ae(enc(ord('['), mods=shift | alt), "\x1b" + '{')
ae(enc(ord('['), mods=ctrl), '\x1b')
ae(enc(ord('['), mods=ctrl | alt), "\x1b" + '\x1b')
ae(enc(ord(']')), ']')
ae(enc(ord(']'), mods=shift), '}')
ae(enc(ord(']'), mods=alt), "\x1b" + ']')
ae(enc(ord(']'), mods=shift | alt), "\x1b" + '}')
ae(enc(ord(']'), mods=ctrl), '\x1d')
ae(enc(ord(']'), mods=ctrl | alt), "\x1b" + '\x1d')
ae(enc(ord('\\')), '\\')
ae(enc(ord('\\'), mods=shift), '|')
ae(enc(ord('\\'), mods=alt), "\x1b" + '\\')
ae(enc(ord('\\'), mods=shift | alt), "\x1b" + '|')
ae(enc(ord('\\'), mods=ctrl), '\x1c')
ae(enc(ord('\\'), mods=ctrl | alt), "\x1b" + '\x1c')
ae(enc(ord(';')), ';')
ae(enc(ord(';'), mods=shift), ':')
ae(enc(ord(';'), mods=alt), "\x1b" + ';')
ae(enc(ord(';'), mods=shift | alt), "\x1b" + ':')
ae(enc(ord(';'), mods=ctrl), ';')
ae(enc(ord(';'), mods=ctrl | alt), "\x1b" + ';')
ae(enc(ord("'")), "'")
ae(enc(ord("'"), mods=shift), '"')
ae(enc(ord("'"), mods=alt), "\x1b" + "'")
ae(enc(ord("'"), mods=shift | alt), "\x1b" + '"')
ae(enc(ord("'"), mods=ctrl), "'")
ae(enc(ord("'"), mods=ctrl | alt), "\x1b" + "'")
ae(enc(ord(',')), ',')
ae(enc(ord(','), mods=shift), '<')
ae(enc(ord(','), mods=alt), "\x1b" + ',')
ae(enc(ord(','), mods=shift | alt), "\x1b" + '<')
ae(enc(ord(','), mods=ctrl), ',')
ae(enc(ord(','), mods=ctrl | alt), "\x1b" + ',')
ae(enc(ord('.')), '.')
ae(enc(ord('.'), mods=shift), '>')
ae(enc(ord('.'), mods=alt), "\x1b" + '.')
ae(enc(ord('.'), mods=shift | alt), "\x1b" + '>')
ae(enc(ord('.'), mods=ctrl), '.')
ae(enc(ord('.'), mods=ctrl | alt), "\x1b" + '.')
ae(enc(ord('/')), '/')
ae(enc(ord('/'), mods=shift), '?')
ae(enc(ord('/'), mods=alt), "\x1b" + '/')
ae(enc(ord('/'), mods=shift | alt), "\x1b" + '?')
ae(enc(ord('/'), mods=ctrl), '\x1f')
ae(enc(ord('/'), mods=ctrl | alt), "\x1b" + '\x1f')
ae(enc(ord('a')), 'a')
ae(enc(ord('a'), mods=shift), 'A')
ae(enc(ord('a'), mods=alt), "\x1b" + 'a')
ae(enc(ord('a'), mods=shift | alt), "\x1b" + 'A')
ae(enc(ord('a'), mods=ctrl), '\x01')
ae(enc(ord('a'), mods=ctrl | alt), "\x1b" + '\x01')
ae(enc(ord('b')), 'b')
ae(enc(ord('b'), mods=shift), 'B')
ae(enc(ord('b'), mods=alt), "\x1b" + 'b')
ae(enc(ord('b'), mods=shift | alt), "\x1b" + 'B')
ae(enc(ord('b'), mods=ctrl), '\x02')
ae(enc(ord('b'), mods=ctrl | alt), "\x1b" + '\x02')
ae(enc(ord('c')), 'c')
ae(enc(ord('c'), mods=shift), 'C')
ae(enc(ord('c'), mods=alt), "\x1b" + 'c')
ae(enc(ord('c'), mods=shift | alt), "\x1b" + 'C')
ae(enc(ord('c'), mods=ctrl), '\x03')
ae(enc(ord('c'), mods=ctrl | alt), "\x1b" + '\x03')
ae(enc(ord('d')), 'd')
ae(enc(ord('d'), mods=shift), 'D')
ae(enc(ord('d'), mods=alt), "\x1b" + 'd')
ae(enc(ord('d'), mods=shift | alt), "\x1b" + 'D')
ae(enc(ord('d'), mods=ctrl), '\x04')
ae(enc(ord('d'), mods=ctrl | alt), "\x1b" + '\x04')
ae(enc(ord('e')), 'e')
ae(enc(ord('e'), mods=shift), 'E')
ae(enc(ord('e'), mods=alt), "\x1b" + 'e')
ae(enc(ord('e'), mods=shift | alt), "\x1b" + 'E')
ae(enc(ord('e'), mods=ctrl), '\x05')
ae(enc(ord('e'), mods=ctrl | alt), "\x1b" + '\x05')
ae(enc(ord('f')), 'f')
ae(enc(ord('f'), mods=shift), 'F')
ae(enc(ord('f'), mods=alt), "\x1b" + 'f')
ae(enc(ord('f'), mods=shift | alt), "\x1b" + 'F')
ae(enc(ord('f'), mods=ctrl), '\x06')
ae(enc(ord('f'), mods=ctrl | alt), "\x1b" + '\x06')
ae(enc(ord('g')), 'g')
ae(enc(ord('g'), mods=shift), 'G')
ae(enc(ord('g'), mods=alt), "\x1b" + 'g')
ae(enc(ord('g'), mods=shift | alt), "\x1b" + 'G')
ae(enc(ord('g'), mods=ctrl), '\x07')
ae(enc(ord('g'), mods=ctrl | alt), "\x1b" + '\x07')
ae(enc(ord('h')), 'h')
ae(enc(ord('h'), mods=shift), 'H')
ae(enc(ord('h'), mods=alt), "\x1b" + 'h')
ae(enc(ord('h'), mods=shift | alt), "\x1b" + 'H')
ae(enc(ord('h'), mods=ctrl), '\x08')
ae(enc(ord('h'), mods=ctrl | alt), "\x1b" + '\x08')
ae(enc(ord('i')), 'i')
ae(enc(ord('i'), mods=shift), 'I')
ae(enc(ord('i'), mods=alt), "\x1b" + 'i')
ae(enc(ord('i'), mods=shift | alt), "\x1b" + 'I')
ae(enc(ord('i'), mods=ctrl), '\t')
ae(enc(ord('i'), mods=ctrl | alt), "\x1b" + '\t')
ae(enc(ord('j')), 'j')
ae(enc(ord('j'), mods=shift), 'J')
ae(enc(ord('j'), mods=alt), "\x1b" + 'j')
ae(enc(ord('j'), mods=shift | alt), "\x1b" + 'J')
ae(enc(ord('j'), mods=ctrl), '\n')
ae(enc(ord('j'), mods=ctrl | alt), "\x1b" + '\n')
ae(enc(ord('k')), 'k')
ae(enc(ord('k'), mods=shift), 'K')
ae(enc(ord('k'), mods=alt), "\x1b" + 'k')
ae(enc(ord('k'), mods=shift | alt), "\x1b" + 'K')
ae(enc(ord('k'), mods=ctrl), '\x0b')
ae(enc(ord('k'), mods=ctrl | alt), "\x1b" + '\x0b')
ae(enc(ord('l')), 'l')
ae(enc(ord('l'), mods=shift), 'L')
ae(enc(ord('l'), mods=alt), "\x1b" + 'l')
ae(enc(ord('l'), mods=shift | alt), "\x1b" + 'L')
ae(enc(ord('l'), mods=ctrl), '\x0c')
ae(enc(ord('l'), mods=ctrl | alt), "\x1b" + '\x0c')
ae(enc(ord('m')), 'm')
ae(enc(ord('m'), mods=shift), 'M')
ae(enc(ord('m'), mods=alt), "\x1b" + 'm')
ae(enc(ord('m'), mods=shift | alt), "\x1b" + 'M')
ae(enc(ord('m'), mods=ctrl), '\r')
ae(enc(ord('m'), mods=ctrl | alt), "\x1b" + '\r')
ae(enc(ord('n')), 'n')
ae(enc(ord('n'), mods=shift), 'N')
ae(enc(ord('n'), mods=alt), "\x1b" + 'n')
ae(enc(ord('n'), mods=shift | alt), "\x1b" + 'N')
ae(enc(ord('n'), mods=ctrl), '\x0e')
ae(enc(ord('n'), mods=ctrl | alt), "\x1b" + '\x0e')
ae(enc(ord('o')), 'o')
ae(enc(ord('o'), mods=shift), 'O')
ae(enc(ord('o'), mods=alt), "\x1b" + 'o')
ae(enc(ord('o'), mods=shift | alt), "\x1b" + 'O')
ae(enc(ord('o'), mods=ctrl), '\x0f')
ae(enc(ord('o'), mods=ctrl | alt), "\x1b" + '\x0f')
ae(enc(ord('p')), 'p')
ae(enc(ord('p'), mods=shift), 'P')
ae(enc(ord('p'), mods=alt), "\x1b" + 'p')
ae(enc(ord('p'), mods=shift | alt), "\x1b" + 'P')
ae(enc(ord('p'), mods=ctrl), '\x10')
ae(enc(ord('p'), mods=ctrl | alt), "\x1b" + '\x10')
ae(enc(ord('q')), 'q')
ae(enc(ord('q'), mods=shift), 'Q')
ae(enc(ord('q'), mods=alt), "\x1b" + 'q')
ae(enc(ord('q'), mods=shift | alt), "\x1b" + 'Q')
ae(enc(ord('q'), mods=ctrl), '\x11')
ae(enc(ord('q'), mods=ctrl | alt), "\x1b" + '\x11')
ae(enc(ord('r')), 'r')
ae(enc(ord('r'), mods=shift), 'R')
ae(enc(ord('r'), mods=alt), "\x1b" + 'r')
ae(enc(ord('r'), mods=shift | alt), "\x1b" + 'R')
ae(enc(ord('r'), mods=ctrl), '\x12')
ae(enc(ord('r'), mods=ctrl | alt), "\x1b" + '\x12')
ae(enc(ord('s')), 's')
ae(enc(ord('s'), mods=shift), 'S')
ae(enc(ord('s'), mods=alt), "\x1b" + 's')
ae(enc(ord('s'), mods=shift | alt), "\x1b" + 'S')
ae(enc(ord('s'), mods=ctrl), '\x13')
ae(enc(ord('s'), mods=ctrl | alt), "\x1b" + '\x13')
ae(enc(ord('t')), 't')
ae(enc(ord('t'), mods=shift), 'T')
ae(enc(ord('t'), mods=alt), "\x1b" + 't')
ae(enc(ord('t'), mods=shift | alt), "\x1b" + 'T')
ae(enc(ord('t'), mods=ctrl), '\x14')
ae(enc(ord('t'), mods=ctrl | alt), "\x1b" + '\x14')
ae(enc(ord('u')), 'u')
ae(enc(ord('u'), mods=shift), 'U')
ae(enc(ord('u'), mods=alt), "\x1b" + 'u')
ae(enc(ord('u'), mods=shift | alt), "\x1b" + 'U')
ae(enc(ord('u'), mods=ctrl), '\x15')
ae(enc(ord('u'), mods=ctrl | alt), "\x1b" + '\x15')
ae(enc(ord('v')), 'v')
ae(enc(ord('v'), mods=shift), 'V')
ae(enc(ord('v'), mods=alt), "\x1b" + 'v')
ae(enc(ord('v'), mods=shift | alt), "\x1b" + 'V')
ae(enc(ord('v'), mods=ctrl), '\x16')
ae(enc(ord('v'), mods=ctrl | alt), "\x1b" + '\x16')
ae(enc(ord('w')), 'w')
ae(enc(ord('w'), mods=shift), 'W')
ae(enc(ord('w'), mods=alt), "\x1b" + 'w')
ae(enc(ord('w'), mods=shift | alt), "\x1b" + 'W')
ae(enc(ord('w'), mods=ctrl), '\x17')
ae(enc(ord('w'), mods=ctrl | alt), "\x1b" + '\x17')
ae(enc(ord('x')), 'x')
ae(enc(ord('x'), mods=shift), 'X')
ae(enc(ord('x'), mods=alt), "\x1b" + 'x')
ae(enc(ord('x'), mods=shift | alt), "\x1b" + 'X')
ae(enc(ord('x'), mods=ctrl), '\x18')
ae(enc(ord('x'), mods=ctrl | alt), "\x1b" + '\x18')
ae(enc(ord('y')), 'y')
ae(enc(ord('y'), mods=shift), 'Y')
ae(enc(ord('y'), mods=alt), "\x1b" + 'y')
ae(enc(ord('y'), mods=shift | alt), "\x1b" + 'Y')
ae(enc(ord('y'), mods=ctrl), '\x19')
ae(enc(ord('y'), mods=ctrl | alt), "\x1b" + '\x19')
ae(enc(ord('z')), 'z')
ae(enc(ord('z'), mods=shift), 'Z')
ae(enc(ord('z'), mods=alt), "\x1b" + 'z')
ae(enc(ord('z'), mods=shift | alt), "\x1b" + 'Z')
ae(enc(ord('z'), mods=ctrl), '\x1a')
ae(enc(ord('z'), mods=ctrl | alt), "\x1b" + '\x1a')
ae(enc(ord('`'), shifted_key=ord('~')), '`')
ae(enc(ord('`'), shifted_key=ord('~'), mods=shift), '~')
ae(enc(ord('`'), shifted_key=ord('~'), mods=alt), "\x1b" + '`')
ae(enc(ord('`'), shifted_key=ord('~'), mods=shift | alt), "\x1b" + '~')
ae(enc(ord('`'), shifted_key=ord('~'), mods=ctrl), '`')
ae(enc(ord('`'), shifted_key=ord('~'), mods=ctrl | alt), "\x1b" + '`')
ae(enc(ord('1'), shifted_key=ord('!')), '1')
ae(enc(ord('1'), shifted_key=ord('!'), mods=shift), '!')
ae(enc(ord('1'), shifted_key=ord('!'), mods=alt), "\x1b" + '1')
ae(enc(ord('1'), shifted_key=ord('!'), mods=shift | alt), "\x1b" + '!')
ae(enc(ord('1'), shifted_key=ord('!'), mods=ctrl), '1')
ae(enc(ord('1'), shifted_key=ord('!'), mods=ctrl | alt), "\x1b" + '1')
ae(enc(ord('2'), shifted_key=ord('@')), '2')
ae(enc(ord('2'), shifted_key=ord('@'), mods=shift), '@')
ae(enc(ord('2'), shifted_key=ord('@'), mods=alt), "\x1b" + '2')
ae(enc(ord('2'), shifted_key=ord('@'), mods=shift | alt), "\x1b" + '@')
ae(enc(ord('2'), shifted_key=ord('@'), mods=ctrl), '\x00')
ae(enc(ord('2'), shifted_key=ord('@'), mods=ctrl | alt), "\x1b" + '\x00')
ae(enc(ord('3'), shifted_key=ord('#')), '3')
ae(enc(ord('3'), shifted_key=ord('#'), mods=shift), '#')
ae(enc(ord('3'), shifted_key=ord('#'), mods=alt), "\x1b" + '3')
ae(enc(ord('3'), shifted_key=ord('#'), mods=shift | alt), "\x1b" + '#')
ae(enc(ord('3'), shifted_key=ord('#'), mods=ctrl), '\x1b')
ae(enc(ord('3'), shifted_key=ord('#'), mods=ctrl | alt), "\x1b" + '\x1b')
ae(enc(ord('4'), shifted_key=ord('$')), '4')
ae(enc(ord('4'), shifted_key=ord('$'), mods=shift), '$')
ae(enc(ord('4'), shifted_key=ord('$'), mods=alt), "\x1b" + '4')
ae(enc(ord('4'), shifted_key=ord('$'), mods=shift | alt), "\x1b" + '$')
ae(enc(ord('4'), shifted_key=ord('$'), mods=ctrl), '\x1c')
ae(enc(ord('4'), shifted_key=ord('$'), mods=ctrl | alt), "\x1b" + '\x1c')
ae(enc(ord('5'), shifted_key=ord('%')), '5')
ae(enc(ord('5'), shifted_key=ord('%'), mods=shift), '%')
ae(enc(ord('5'), shifted_key=ord('%'), mods=alt), "\x1b" + '5')
ae(enc(ord('5'), shifted_key=ord('%'), mods=shift | alt), "\x1b" + '%')
ae(enc(ord('5'), shifted_key=ord('%'), mods=ctrl), '\x1d')
ae(enc(ord('5'), shifted_key=ord('%'), mods=ctrl | alt), "\x1b" + '\x1d')
ae(enc(ord('6'), shifted_key=ord('^')), '6')
ae(enc(ord('6'), shifted_key=ord('^'), mods=shift), '^')
ae(enc(ord('6'), shifted_key=ord('^'), mods=alt), "\x1b" + '6')
ae(enc(ord('6'), shifted_key=ord('^'), mods=shift | alt), "\x1b" + '^')
ae(enc(ord('6'), shifted_key=ord('^'), mods=ctrl), '\x1e')
ae(enc(ord('6'), shifted_key=ord('^'), mods=ctrl | alt), "\x1b" + '\x1e')
ae(enc(ord('7'), shifted_key=ord('&')), '7')
ae(enc(ord('7'), shifted_key=ord('&'), mods=shift), '&')
ae(enc(ord('7'), shifted_key=ord('&'), mods=alt), "\x1b" + '7')
ae(enc(ord('7'), shifted_key=ord('&'), mods=shift | alt), "\x1b" + '&')
ae(enc(ord('7'), shifted_key=ord('&'), mods=ctrl), '\x1f')
ae(enc(ord('7'), shifted_key=ord('&'), mods=ctrl | alt), "\x1b" + '\x1f')
ae(enc(ord('8'), shifted_key=ord('*')), '8')
ae(enc(ord('8'), shifted_key=ord('*'), mods=shift), '*')
ae(enc(ord('8'), shifted_key=ord('*'), mods=alt), "\x1b" + '8')
ae(enc(ord('8'), shifted_key=ord('*'), mods=shift | alt), "\x1b" + '*')
ae(enc(ord('8'), shifted_key=ord('*'), mods=ctrl), '\x7f')
ae(enc(ord('8'), shifted_key=ord('*'), mods=ctrl | alt), "\x1b" + '\x7f')
ae(enc(ord('9'), shifted_key=ord('(')), '9')
ae(enc(ord('9'), shifted_key=ord('('), mods=shift), '(')
ae(enc(ord('9'), shifted_key=ord('('), mods=alt), "\x1b" + '9')
ae(enc(ord('9'), shifted_key=ord('('), mods=shift | alt), "\x1b" + '(')
ae(enc(ord('9'), shifted_key=ord('('), mods=ctrl), '9')
ae(enc(ord('9'), shifted_key=ord('('), mods=ctrl | alt), "\x1b" + '9')
ae(enc(ord('0'), shifted_key=ord(')')), '0')
ae(enc(ord('0'), shifted_key=ord(')'), mods=shift), ')')
ae(enc(ord('0'), shifted_key=ord(')'), mods=alt), "\x1b" + '0')
ae(enc(ord('0'), shifted_key=ord(')'), mods=shift | alt), "\x1b" + ')')
ae(enc(ord('0'), shifted_key=ord(')'), mods=ctrl), '0')
ae(enc(ord('0'), shifted_key=ord(')'), mods=ctrl | alt), "\x1b" + '0')
ae(enc(ord('-'), shifted_key=ord('_')), '-')
ae(enc(ord('-'), shifted_key=ord('_'), mods=shift), '_')
ae(enc(ord('-'), shifted_key=ord('_'), mods=alt), "\x1b" + '-')
ae(enc(ord('-'), shifted_key=ord('_'), mods=shift | alt), "\x1b" + '_')
ae(enc(ord('-'), shifted_key=ord('_'), mods=ctrl), '-')
ae(enc(ord('-'), shifted_key=ord('_'), mods=ctrl | alt), "\x1b" + '-')
ae(enc(ord('='), shifted_key=ord('+')), '=')
ae(enc(ord('='), shifted_key=ord('+'), mods=shift), '+')
ae(enc(ord('='), shifted_key=ord('+'), mods=alt), "\x1b" + '=')
ae(enc(ord('='), shifted_key=ord('+'), mods=shift | alt), "\x1b" + '+')
ae(enc(ord('='), shifted_key=ord('+'), mods=ctrl), '=')
ae(enc(ord('='), shifted_key=ord('+'), mods=ctrl | alt), "\x1b" + '=')
ae(enc(ord('['), shifted_key=ord('{')), '[')
ae(enc(ord('['), shifted_key=ord('{'), mods=shift), '{')
ae(enc(ord('['), shifted_key=ord('{'), mods=alt), "\x1b" + '[')
ae(enc(ord('['), shifted_key=ord('{'), mods=shift | alt), "\x1b" + '{')
ae(enc(ord('['), shifted_key=ord('{'), mods=ctrl), '\x1b')
ae(enc(ord('['), shifted_key=ord('{'), mods=ctrl | alt), "\x1b" + '\x1b')
ae(enc(ord(']'), shifted_key=ord('}')), ']')
ae(enc(ord(']'), shifted_key=ord('}'), mods=shift), '}')
ae(enc(ord(']'), shifted_key=ord('}'), mods=alt), "\x1b" + ']')
ae(enc(ord(']'), shifted_key=ord('}'), mods=shift | alt), "\x1b" + '}')
ae(enc(ord(']'), shifted_key=ord('}'), mods=ctrl), '\x1d')
ae(enc(ord(']'), shifted_key=ord('}'), mods=ctrl | alt), "\x1b" + '\x1d')
ae(enc(ord('\\'), shifted_key=ord('|')), '\\')
ae(enc(ord('\\'), shifted_key=ord('|'), mods=shift), '|')
ae(enc(ord('\\'), shifted_key=ord('|'), mods=alt), "\x1b" + '\\')
ae(enc(ord('\\'), shifted_key=ord('|'), mods=shift | alt), "\x1b" + '|')
ae(enc(ord('\\'), shifted_key=ord('|'), mods=ctrl), '\x1c')
ae(enc(ord('\\'), shifted_key=ord('|'), mods=ctrl | alt), "\x1b" + '\x1c')
ae(enc(ord(';'), shifted_key=ord(':')), ';')
ae(enc(ord(';'), shifted_key=ord(':'), mods=shift), ':')
ae(enc(ord(';'), shifted_key=ord(':'), mods=alt), "\x1b" + ';')
ae(enc(ord(';'), shifted_key=ord(':'), mods=shift | alt), "\x1b" + ':')
ae(enc(ord(';'), shifted_key=ord(':'), mods=ctrl), ';')
ae(enc(ord(';'), shifted_key=ord(':'), mods=ctrl | alt), "\x1b" + ';')
ae(enc(ord("'"), shifted_key=ord('"')), "'")
ae(enc(ord("'"), shifted_key=ord('"'), mods=shift), '"')
ae(enc(ord("'"), shifted_key=ord('"'), mods=alt), "\x1b" + "'")
ae(enc(ord("'"), shifted_key=ord('"'), mods=shift | alt), "\x1b" + '"')
ae(enc(ord("'"), shifted_key=ord('"'), mods=ctrl), "'")
ae(enc(ord("'"), shifted_key=ord('"'), mods=ctrl | alt), "\x1b" + "'")
ae(enc(ord(','), shifted_key=ord('<')), ',')
ae(enc(ord(','), shifted_key=ord('<'), mods=shift), '<')
ae(enc(ord(','), shifted_key=ord('<'), mods=alt), "\x1b" + ',')
ae(enc(ord(','), shifted_key=ord('<'), mods=shift | alt), "\x1b" + '<')
ae(enc(ord(','), shifted_key=ord('<'), mods=ctrl), ',')
ae(enc(ord(','), shifted_key=ord('<'), mods=ctrl | alt), "\x1b" + ',')
ae(enc(ord('.'), shifted_key=ord('>')), '.')
ae(enc(ord('.'), shifted_key=ord('>'), mods=shift), '>')
ae(enc(ord('.'), shifted_key=ord('>'), mods=alt), "\x1b" + '.')
ae(enc(ord('.'), shifted_key=ord('>'), mods=shift | alt), "\x1b" + '>')
ae(enc(ord('.'), shifted_key=ord('>'), mods=ctrl), '.')
ae(enc(ord('.'), shifted_key=ord('>'), mods=ctrl | alt), "\x1b" + '.')
ae(enc(ord('/'), shifted_key=ord('?')), '/')
ae(enc(ord('/'), shifted_key=ord('?'), mods=shift), '?')
ae(enc(ord('/'), shifted_key=ord('?'), mods=alt), "\x1b" + '/')
ae(enc(ord('/'), shifted_key=ord('?'), mods=shift | alt), "\x1b" + '?')
ae(enc(ord('/'), shifted_key=ord('?'), mods=ctrl), '\x1f')
ae(enc(ord('/'), shifted_key=ord('?'), mods=ctrl | alt), "\x1b" + '\x1f')
ae(enc(ord('a'), shifted_key=ord('A')), 'a')
ae(enc(ord('a'), shifted_key=ord('A'), mods=shift), 'A')
ae(enc(ord('a'), shifted_key=ord('A'), mods=alt), "\x1b" + 'a')
ae(enc(ord('a'), shifted_key=ord('A'), mods=shift | alt), "\x1b" + 'A')
ae(enc(ord('a'), shifted_key=ord('A'), mods=ctrl), '\x01')
ae(enc(ord('a'), shifted_key=ord('A'), mods=ctrl | alt), "\x1b" + '\x01')
ae(enc(ord('b'), shifted_key=ord('B')), 'b')
ae(enc(ord('b'), shifted_key=ord('B'), mods=shift), 'B')
ae(enc(ord('b'), shifted_key=ord('B'), mods=alt), "\x1b" + 'b')
ae(enc(ord('b'), shifted_key=ord('B'), mods=shift | alt), "\x1b" + 'B')
ae(enc(ord('b'), shifted_key=ord('B'), mods=ctrl), '\x02')
ae(enc(ord('b'), shifted_key=ord('B'), mods=ctrl | alt), "\x1b" + '\x02')
ae(enc(ord('c'), shifted_key=ord('C')), 'c')
ae(enc(ord('c'), shifted_key=ord('C'), mods=shift), 'C')
ae(enc(ord('c'), shifted_key=ord('C'), mods=alt), "\x1b" + 'c')
ae(enc(ord('c'), shifted_key=ord('C'), mods=shift | alt), "\x1b" + 'C')
ae(enc(ord('c'), shifted_key=ord('C'), mods=ctrl), '\x03')
ae(enc(ord('c'), shifted_key=ord('C'), mods=ctrl | alt), "\x1b" + '\x03')
ae(enc(ord('d'), shifted_key=ord('D')), 'd')
ae(enc(ord('d'), shifted_key=ord('D'), mods=shift), 'D')
ae(enc(ord('d'), shifted_key=ord('D'), mods=alt), "\x1b" + 'd')
ae(enc(ord('d'), shifted_key=ord('D'), mods=shift | alt), "\x1b" + 'D')
ae(enc(ord('d'), shifted_key=ord('D'), mods=ctrl), '\x04')
ae(enc(ord('d'), shifted_key=ord('D'), mods=ctrl | alt), "\x1b" + '\x04')
ae(enc(ord('e'), shifted_key=ord('E')), 'e')
ae(enc(ord('e'), shifted_key=ord('E'), mods=shift), 'E')
ae(enc(ord('e'), shifted_key=ord('E'), mods=alt), "\x1b" + 'e')
ae(enc(ord('e'), shifted_key=ord('E'), mods=shift | alt), "\x1b" + 'E')
ae(enc(ord('e'), shifted_key=ord('E'), mods=ctrl), '\x05')
ae(enc(ord('e'), shifted_key=ord('E'), mods=ctrl | alt), "\x1b" + '\x05')
ae(enc(ord('f'), shifted_key=ord('F')), 'f')
ae(enc(ord('f'), shifted_key=ord('F'), mods=shift), 'F')
ae(enc(ord('f'), shifted_key=ord('F'), mods=alt), "\x1b" + 'f')
ae(enc(ord('f'), shifted_key=ord('F'), mods=shift | alt), "\x1b" + 'F')
ae(enc(ord('f'), shifted_key=ord('F'), mods=ctrl), '\x06')
ae(enc(ord('f'), shifted_key=ord('F'), mods=ctrl | alt), "\x1b" + '\x06')
ae(enc(ord('g'), shifted_key=ord('G')), 'g')
ae(enc(ord('g'), shifted_key=ord('G'), mods=shift), 'G')
ae(enc(ord('g'), shifted_key=ord('G'), mods=alt), "\x1b" + 'g')
ae(enc(ord('g'), shifted_key=ord('G'), mods=shift | alt), "\x1b" + 'G')
ae(enc(ord('g'), shifted_key=ord('G'), mods=ctrl), '\x07')
ae(enc(ord('g'), shifted_key=ord('G'), mods=ctrl | alt), "\x1b" + '\x07')
ae(enc(ord('h'), shifted_key=ord('H')), 'h')
ae(enc(ord('h'), shifted_key=ord('H'), mods=shift), 'H')
ae(enc(ord('h'), shifted_key=ord('H'), mods=alt), "\x1b" + 'h')
ae(enc(ord('h'), shifted_key=ord('H'), mods=shift | alt), "\x1b" + 'H')
ae(enc(ord('h'), shifted_key=ord('H'), mods=ctrl), '\x08')
ae(enc(ord('h'), shifted_key=ord('H'), mods=ctrl | alt), "\x1b" + '\x08')
ae(enc(ord('i'), shifted_key=ord('I')), 'i')
ae(enc(ord('i'), shifted_key=ord('I'), mods=shift), 'I')
ae(enc(ord('i'), shifted_key=ord('I'), mods=alt), "\x1b" + 'i')
ae(enc(ord('i'), shifted_key=ord('I'), mods=shift | alt), "\x1b" + 'I')
ae(enc(ord('i'), shifted_key=ord('I'), mods=ctrl), '\t')
ae(enc(ord('i'), shifted_key=ord('I'), mods=ctrl | alt), "\x1b" + '\t')
ae(enc(ord('j'), shifted_key=ord('J')), 'j')
ae(enc(ord('j'), shifted_key=ord('J'), mods=shift), 'J')
ae(enc(ord('j'), shifted_key=ord('J'), mods=alt), "\x1b" + 'j')
ae(enc(ord('j'), shifted_key=ord('J'), mods=shift | alt), "\x1b" + 'J')
ae(enc(ord('j'), shifted_key=ord('J'), mods=ctrl), '\n')
ae(enc(ord('j'), shifted_key=ord('J'), mods=ctrl | alt), "\x1b" + '\n')
ae(enc(ord('k'), shifted_key=ord('K')), 'k')
ae(enc(ord('k'), shifted_key=ord('K'), mods=shift), 'K')
ae(enc(ord('k'), shifted_key=ord('K'), mods=alt), "\x1b" + 'k')
ae(enc(ord('k'), shifted_key=ord('K'), mods=shift | alt), "\x1b" + 'K')
ae(enc(ord('k'), shifted_key=ord('K'), mods=ctrl), '\x0b')
ae(enc(ord('k'), shifted_key=ord('K'), mods=ctrl | alt), "\x1b" + '\x0b')
ae(enc(ord('l'), shifted_key=ord('L')), 'l')
ae(enc(ord('l'), shifted_key=ord('L'), mods=shift), 'L')
ae(enc(ord('l'), shifted_key=ord('L'), mods=alt), "\x1b" + 'l')
ae(enc(ord('l'), shifted_key=ord('L'), mods=shift | alt), "\x1b" + 'L')
ae(enc(ord('l'), shifted_key=ord('L'), mods=ctrl), '\x0c')
ae(enc(ord('l'), shifted_key=ord('L'), mods=ctrl | alt), "\x1b" + '\x0c')
ae(enc(ord('m'), shifted_key=ord('M')), 'm')
ae(enc(ord('m'), shifted_key=ord('M'), mods=shift), 'M')
ae(enc(ord('m'), shifted_key=ord('M'), mods=alt), "\x1b" + 'm')
ae(enc(ord('m'), shifted_key=ord('M'), mods=shift | alt), "\x1b" + 'M')
ae(enc(ord('m'), shifted_key=ord('M'), mods=ctrl), '\r')
ae(enc(ord('m'), shifted_key=ord('M'), mods=ctrl | alt), "\x1b" + '\r')
ae(enc(ord('n'), shifted_key=ord('N')), 'n')
ae(enc(ord('n'), shifted_key=ord('N'), mods=shift), 'N')
ae(enc(ord('n'), shifted_key=ord('N'), mods=alt), "\x1b" + 'n')
ae(enc(ord('n'), shifted_key=ord('N'), mods=shift | alt), "\x1b" + 'N')
ae(enc(ord('n'), shifted_key=ord('N'), mods=ctrl), '\x0e')
ae(enc(ord('n'), shifted_key=ord('N'), mods=ctrl | alt), "\x1b" + '\x0e')
ae(enc(ord('o'), shifted_key=ord('O')), 'o')
ae(enc(ord('o'), shifted_key=ord('O'), mods=shift), 'O')
ae(enc(ord('o'), shifted_key=ord('O'), mods=alt), "\x1b" + 'o')
ae(enc(ord('o'), shifted_key=ord('O'), mods=shift | alt), "\x1b" + 'O')
ae(enc(ord('o'), shifted_key=ord('O'), mods=ctrl), '\x0f')
ae(enc(ord('o'), shifted_key=ord('O'), mods=ctrl | alt), "\x1b" + '\x0f')
ae(enc(ord('p'), shifted_key=ord('P')), 'p')
ae(enc(ord('p'), shifted_key=ord('P'), mods=shift), 'P')
ae(enc(ord('p'), shifted_key=ord('P'), mods=alt), "\x1b" + 'p')
ae(enc(ord('p'), shifted_key=ord('P'), mods=shift | alt), "\x1b" + 'P')
ae(enc(ord('p'), shifted_key=ord('P'), mods=ctrl), '\x10')
ae(enc(ord('p'), shifted_key=ord('P'), mods=ctrl | alt), "\x1b" + '\x10')
ae(enc(ord('q'), shifted_key=ord('Q')), 'q')
ae(enc(ord('q'), shifted_key=ord('Q'), mods=shift), 'Q')
ae(enc(ord('q'), shifted_key=ord('Q'), mods=alt), "\x1b" + 'q')
ae(enc(ord('q'), shifted_key=ord('Q'), mods=shift | alt), "\x1b" + 'Q')
ae(enc(ord('q'), shifted_key=ord('Q'), mods=ctrl), '\x11')
ae(enc(ord('q'), shifted_key=ord('Q'), mods=ctrl | alt), "\x1b" + '\x11')
ae(enc(ord('r'), shifted_key=ord('R')), 'r')
ae(enc(ord('r'), shifted_key=ord('R'), mods=shift), 'R')
ae(enc(ord('r'), shifted_key=ord('R'), mods=alt), "\x1b" + 'r')
ae(enc(ord('r'), shifted_key=ord('R'), mods=shift | alt), "\x1b" + 'R')
ae(enc(ord('r'), shifted_key=ord('R'), mods=ctrl), '\x12')
ae(enc(ord('r'), shifted_key=ord('R'), mods=ctrl | alt), "\x1b" + '\x12')
ae(enc(ord('s'), shifted_key=ord('S')), 's')
ae(enc(ord('s'), shifted_key=ord('S'), mods=shift), 'S')
ae(enc(ord('s'), shifted_key=ord('S'), mods=alt), "\x1b" + 's')
ae(enc(ord('s'), shifted_key=ord('S'), mods=shift | alt), "\x1b" + 'S')
ae(enc(ord('s'), shifted_key=ord('S'), mods=ctrl), '\x13')
ae(enc(ord('s'), shifted_key=ord('S'), mods=ctrl | alt), "\x1b" + '\x13')
ae(enc(ord('t'), shifted_key=ord('T')), 't')
ae(enc(ord('t'), shifted_key=ord('T'), mods=shift), 'T')
ae(enc(ord('t'), shifted_key=ord('T'), mods=alt), "\x1b" + 't')
ae(enc(ord('t'), shifted_key=ord('T'), mods=shift | alt), "\x1b" + 'T')
ae(enc(ord('t'), shifted_key=ord('T'), mods=ctrl), '\x14')
ae(enc(ord('t'), shifted_key=ord('T'), mods=ctrl | alt), "\x1b" + '\x14')
ae(enc(ord('u'), shifted_key=ord('U')), 'u')
ae(enc(ord('u'), shifted_key=ord('U'), mods=shift), 'U')
ae(enc(ord('u'), shifted_key=ord('U'), mods=alt), "\x1b" + 'u')
ae(enc(ord('u'), shifted_key=ord('U'), mods=shift | alt), "\x1b" + 'U')
ae(enc(ord('u'), shifted_key=ord('U'), mods=ctrl), '\x15')
ae(enc(ord('u'), shifted_key=ord('U'), mods=ctrl | alt), "\x1b" + '\x15')
ae(enc(ord('v'), shifted_key=ord('V')), 'v')
ae(enc(ord('v'), shifted_key=ord('V'), mods=shift), 'V')
ae(enc(ord('v'), shifted_key=ord('V'), mods=alt), "\x1b" + 'v')
ae(enc(ord('v'), shifted_key=ord('V'), mods=shift | alt), "\x1b" + 'V')
ae(enc(ord('v'), shifted_key=ord('V'), mods=ctrl), '\x16')
ae(enc(ord('v'), shifted_key=ord('V'), mods=ctrl | alt), "\x1b" + '\x16')
ae(enc(ord('w'), shifted_key=ord('W')), 'w')
ae(enc(ord('w'), shifted_key=ord('W'), mods=shift), 'W')
ae(enc(ord('w'), shifted_key=ord('W'), mods=alt), "\x1b" + 'w')
ae(enc(ord('w'), shifted_key=ord('W'), mods=shift | alt), "\x1b" + 'W')
ae(enc(ord('w'), shifted_key=ord('W'), mods=ctrl), '\x17')
ae(enc(ord('w'), shifted_key=ord('W'), mods=ctrl | alt), "\x1b" + '\x17')
ae(enc(ord('x'), shifted_key=ord('X')), 'x')
ae(enc(ord('x'), shifted_key=ord('X'), mods=shift), 'X')
ae(enc(ord('x'), shifted_key=ord('X'), mods=alt), "\x1b" + 'x')
ae(enc(ord('x'), shifted_key=ord('X'), mods=shift | alt), "\x1b" + 'X')
ae(enc(ord('x'), shifted_key=ord('X'), mods=ctrl), '\x18')
ae(enc(ord('x'), shifted_key=ord('X'), mods=ctrl | alt), "\x1b" + '\x18')
ae(enc(ord('y'), shifted_key=ord('Y')), 'y')
ae(enc(ord('y'), shifted_key=ord('Y'), mods=shift), 'Y')
ae(enc(ord('y'), shifted_key=ord('Y'), mods=alt), "\x1b" + 'y')
ae(enc(ord('y'), shifted_key=ord('Y'), mods=shift | alt), "\x1b" + 'Y')
ae(enc(ord('y'), shifted_key=ord('Y'), mods=ctrl), '\x19')
ae(enc(ord('y'), shifted_key=ord('Y'), mods=ctrl | alt), "\x1b" + '\x19')
ae(enc(ord('z'), shifted_key=ord('Z')), 'z')
ae(enc(ord('z'), shifted_key=ord('Z'), mods=shift), 'Z')
ae(enc(ord('z'), shifted_key=ord('Z'), mods=alt), "\x1b" + 'z')
ae(enc(ord('z'), shifted_key=ord('Z'), mods=shift | alt), "\x1b" + 'Z')
ae(enc(ord('z'), shifted_key=ord('Z'), mods=ctrl), '\x1a')
ae(enc(ord('z'), shifted_key=ord('Z'), mods=ctrl | alt), "\x1b" + '\x1a')
# end legacy letter tests
# }}}
ae(enc(key=ord(':'), shifted_key=ord('/'), mods=shift | alt), '\x1b/')
ae(enc(key=ord(' ')), ' ')
ae(enc(key=ord(' '), mods=ctrl), '\0')
ae(enc(key=ord('i'), mods=ctrl | shift), csi(ctrl | shift, ord('i')))