mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-27 18:51:41 +02:00
Fix update_encoding() not filtering GLFW_KEY_LAST_PRINTABLE
b3b830bb5f 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:
6
kitty/key_encoding.py
generated
6
kitty/key_encoding.py
generated
@@ -296,11 +296,11 @@ def update_encoding():
|
|||||||
key_map = {}
|
key_map = {}
|
||||||
i = len(ans)
|
i = len(ans)
|
||||||
for k in sorted(keys, key=lambda k: getattr(defines, k)):
|
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)
|
val = getattr(defines, k)
|
||||||
name = symbolic_name(k)
|
name = symbolic_name(k)
|
||||||
if val <= defines.GLFW_KEY_LAST and name not in (
|
if val <= defines.GLFW_KEY_LAST and val != defines.GLFW_KEY_UNKNOWN:
|
||||||
'LAST', 'LAST_PRINTABLE'
|
|
||||||
) and val != defines.GLFW_KEY_UNKNOWN:
|
|
||||||
if name not in ans:
|
if name not in ans:
|
||||||
ans[name] = encode(i)
|
ans[name] = encode(i)
|
||||||
i += 1
|
i += 1
|
||||||
|
|||||||
Reference in New Issue
Block a user