Define shifted variants for a few common keys
This commit is contained in:
parent
bbea86020a
commit
27170a481f
@ -27,6 +27,14 @@ key_map[defines.GLFW_KEY_ENTER] = b'\r'
|
|||||||
key_map[defines.GLFW_KEY_BACKSPACE] = b'\x08'
|
key_map[defines.GLFW_KEY_BACKSPACE] = b'\x08'
|
||||||
key_map[defines.GLFW_KEY_TAB] = b'\t'
|
key_map[defines.GLFW_KEY_TAB] = b'\t'
|
||||||
|
|
||||||
|
SHIFTED_KEYS = {
|
||||||
|
defines.GLFW_KEY_TAB: key_as_bytes('kcbt'),
|
||||||
|
defines.GLFW_KEY_HOME: key_as_bytes('kHOM'),
|
||||||
|
defines.GLFW_KEY_END: key_as_bytes('kEND'),
|
||||||
|
defines.GLFW_KEY_LEFT: key_as_bytes('kLFT'),
|
||||||
|
defines.GLFW_KEY_RIGHT: key_as_bytes('kRIT'),
|
||||||
|
}
|
||||||
|
|
||||||
control_codes = {k: 1 + i for i, k in enumerate(range(defines.GLFW_KEY_A, defines.GLFW_KEY_RIGHT_BRACKET))}
|
control_codes = {k: 1 + i for i, k in enumerate(range(defines.GLFW_KEY_A, defines.GLFW_KEY_RIGHT_BRACKET))}
|
||||||
alt_codes = {k: (0x1b, k) for i, k in enumerate(range(defines.GLFW_KEY_A, defines.GLFW_KEY_RIGHT_BRACKET))}
|
alt_codes = {k: (0x1b, k) for i, k in enumerate(range(defines.GLFW_KEY_A, defines.GLFW_KEY_RIGHT_BRACKET))}
|
||||||
|
|
||||||
@ -43,8 +51,7 @@ def interpret_key_event(key, scancode, mods):
|
|||||||
x = key_map.get(key)
|
x = key_map.get(key)
|
||||||
if x is not None:
|
if x is not None:
|
||||||
if mods == defines.GLFW_MOD_SHIFT:
|
if mods == defines.GLFW_MOD_SHIFT:
|
||||||
if key == defines.GLFW_KEY_TAB:
|
x = SHIFTED_KEYS.get(key, x)
|
||||||
x = b'\x1b[Z'
|
|
||||||
data.extend(x)
|
data.extend(x)
|
||||||
return bytes(data)
|
return bytes(data)
|
||||||
|
|
||||||
|
|||||||
@ -222,6 +222,18 @@ string_capabilities = {
|
|||||||
# Select alternate charset
|
# Select alternate charset
|
||||||
'smacs': r'\E(0',
|
'smacs': r'\E(0',
|
||||||
'rmacs': r'\E(B',
|
'rmacs': r'\E(B',
|
||||||
|
# Shifted keys
|
||||||
|
'kRIT': r'\E[1;2C',
|
||||||
|
'kLFT': r'\E[1;2D',
|
||||||
|
'kEND': r'\E[1;2F',
|
||||||
|
'kHOM': r'\E[1;2H',
|
||||||
|
# Special keys
|
||||||
|
'khlp': r'',
|
||||||
|
'kund': r'',
|
||||||
|
'ka1': r'',
|
||||||
|
'ka3': r'',
|
||||||
|
'kc1': r'',
|
||||||
|
'kc3': r'',
|
||||||
}
|
}
|
||||||
|
|
||||||
termcap_aliases.update({
|
termcap_aliases.update({
|
||||||
@ -317,7 +329,16 @@ termcap_aliases.update({
|
|||||||
'ZR': 'ritm',
|
'ZR': 'ritm',
|
||||||
'as': 'smacs',
|
'as': 'smacs',
|
||||||
'ae': 'rmacs',
|
'ae': 'rmacs',
|
||||||
|
'#2': 'kHOM',
|
||||||
|
'#4': 'kLFT',
|
||||||
|
'*7': 'kEND',
|
||||||
|
'%i': 'kRIT',
|
||||||
|
'%1': 'khlp',
|
||||||
|
'&8': 'kund',
|
||||||
|
'K1': 'ka1',
|
||||||
|
'K3': 'ka3',
|
||||||
|
'K4': 'kc1',
|
||||||
|
'K5': 'kc3',
|
||||||
})
|
})
|
||||||
|
|
||||||
queryable_capabilities = numeric_capabilities.copy()
|
queryable_capabilities = numeric_capabilities.copy()
|
||||||
|
|||||||
@ -1,17 +1,17 @@
|
|||||||
xterm-kitty|KovIdTTY,
|
xterm-kitty|KovIdTTY,
|
||||||
xenl,
|
|
||||||
msgr,
|
msgr,
|
||||||
|
mir,
|
||||||
npc,
|
npc,
|
||||||
am,
|
xenl,
|
||||||
km,
|
km,
|
||||||
ccc,
|
ccc,
|
||||||
mir,
|
|
||||||
mc5i,
|
mc5i,
|
||||||
lines#24,
|
am,
|
||||||
pairs#32767,
|
|
||||||
it#8,
|
|
||||||
cols#80,
|
|
||||||
colors#256,
|
colors#256,
|
||||||
|
it#8,
|
||||||
|
pairs#32767,
|
||||||
|
lines#24,
|
||||||
|
cols#80,
|
||||||
acsc=++\,\,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
|
acsc=++\,\,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
|
||||||
bel=^G,
|
bel=^G,
|
||||||
bold=\E[1m,
|
bold=\E[1m,
|
||||||
@ -50,6 +50,10 @@ xterm-kitty|KovIdTTY,
|
|||||||
il1=\E[L,
|
il1=\E[L,
|
||||||
ind=^J,
|
ind=^J,
|
||||||
indn=\E[%p1%dS,
|
indn=\E[%p1%dS,
|
||||||
|
kEND=\E[1;2F,
|
||||||
|
kHOM=\E[1;2H,
|
||||||
|
kLFT=\E[1;2D,
|
||||||
|
kRIT=\E[1;2C,
|
||||||
kbs=\177,
|
kbs=\177,
|
||||||
kcbt=\E[Z,
|
kcbt=\E[Z,
|
||||||
kcub1=\EOD,
|
kcub1=\EOD,
|
||||||
@ -70,6 +74,7 @@ xterm-kitty|KovIdTTY,
|
|||||||
kf7=\E[18~,
|
kf7=\E[18~,
|
||||||
kf8=\E[19~,
|
kf8=\E[19~,
|
||||||
kf9=\E[20~,
|
kf9=\E[20~,
|
||||||
|
khlp=,
|
||||||
khome=\EOH,
|
khome=\EOH,
|
||||||
kich1=\E[2~,
|
kich1=\E[2~,
|
||||||
kmous=\E[M,
|
kmous=\E[M,
|
||||||
|
|||||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user