Fix update_encoding() not filtering GLFW_KEY_LAST_PRINTABLE
b3b830bb5ffb8f42d5e2367e5aab03579be3a45f did not actually make `update_encoding()` filter `GLFW_KEY_LAST_PRINTABLE` because `name` contained the key name after applying `symbolic_name()`, which replaces underscores with spaces. Instead of replacing the underscore in `LAST_PRINTABLE` with a space, I moved the check above the call to `symbolic_name()`. This is more readable and future-proof in my opinion.
This commit is contained in:
parent
70c2765a6e
commit
7c52dd2bd8
6
kitty/key_encoding.py
generated
6
kitty/key_encoding.py
generated
@ -296,11 +296,11 @@ def update_encoding():
|
||||
key_map = {}
|
||||
i = len(ans)
|
||||
for k in sorted(keys, key=lambda k: getattr(defines, k)):
|
||||
if k in ('GLFW_KEY_LAST', 'GLFW_KEY_LAST_PRINTABLE'):
|
||||
continue
|
||||
val = getattr(defines, k)
|
||||
name = symbolic_name(k)
|
||||
if val <= defines.GLFW_KEY_LAST and name not in (
|
||||
'LAST', 'LAST_PRINTABLE'
|
||||
) and val != defines.GLFW_KEY_UNKNOWN:
|
||||
if val <= defines.GLFW_KEY_LAST and val != defines.GLFW_KEY_UNKNOWN:
|
||||
if name not in ans:
|
||||
ans[name] = encode(i)
|
||||
i += 1
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user