Match extended keyboard protocol modifier bitmask with the CSIu protocol from xterm

This commit is contained in:
Kovid Goyal 2017-11-08 08:24:15 +05:30
parent 5392ceea7d
commit 1f9acf99b0
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 2909 additions and 2900 deletions

File diff suppressed because it is too large Load Diff

View File

@ -133,8 +133,17 @@ def extended_key_event(key, mods, action):
name = KEY_MAP.get(key) name = KEY_MAP.get(key)
if name is None: if name is None:
return b'' return b''
m = 0
if mods & defines.GLFW_MOD_SHIFT:
m |= 0x1
if mods & defines.GLFW_MOD_ALT:
m |= 0x2
if mods & defines.GLFW_MOD_CONTROL:
m |= 0x4
if mods & defines.GLFW_MOD_SUPER:
m |= 0x8
return '\033_K{}{}{}\033\\'.format( return '\033_K{}{}{}\033\\'.format(
action_map[action], base64_encode(mods), name action_map[action], base64_encode(m), name
).encode('ascii') ).encode('ascii')

View File

@ -139,7 +139,7 @@ The escape sequence encodes the following properties:
Where `<type>` is one of `p` -- press, `r` -- release and `t` -- repeat. Where `<type>` is one of `p` -- press, `r` -- release and `t` -- repeat.
Modifiers is a bitmask represented as a single base64 digit. Shift -- `0x1`, Modifiers is a bitmask represented as a single base64 digit. Shift -- `0x1`,
Control -- `0x2`, Alt -- `0x4` and Super -- `0x8`. `<key>` is a number Alt -- `0x2`, Control -- `0x4` and Super -- `0x8`. `<key>` is a number
(encoded in base85) corresponding to the key pressed. The key name to number (encoded in base85) corresponding to the key pressed. The key name to number
mapping is defined in link:key_encoding.asciidoc[this table]. mapping is defined in link:key_encoding.asciidoc[this table].