diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2021-11-21 10:38:36 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2021-11-28 14:14:53 +0000 |
| commit | e744cee7604eb0a98c4468d9f2160f440b851c7e (patch) | |
| tree | 0f1c5612fa5121b9c826e882d6cafc666f088eb0 /input.c | |
| parent | input: get_current_modifiers() no longer strips insignificant mods (diff) | |
input: kitty: printables are emitted as text, even if Caps- or Num-Lock is in effect
Not sure if this is the best/correct way to do it. But kitty seems to
ignore at least Num-Lock for printables, while it _does_ affect other
keys. For example, Return, which usually emits ‘\r’, are affected by
Num-Lock and emit ‘CSI 13;129u’.
Note that as soon as some other modifier is in effect, the Num-Lock
modifier *is* encoded in the CSI, also for printables.
Diffstat (limited to 'input.c')
| -rw-r--r-- | input.c | 19 |
1 files changed, 15 insertions, 4 deletions
@@ -1145,11 +1145,22 @@ kitty_kbd_protocol(struct seat *seat, struct terminal *term, case XKB_KEY_BackSpace: term_to_slave(term, "\x7f", 1); return; case XKB_KEY_Tab: term_to_slave(term, "\t", 1); return; } + } - if (iswprint(utf32)) { - term_to_slave(term, utf8, count); - return; - } + /* + * Printables without any modifiers are printed as is. + * + * TODO: plain text keys (a-z, 0-9 etc) are still printed as text, + * even when NumLock is active, despite NumLock being a + * significant modifier, *and* despite NumLock affecting other + * keys, like Return and Backspace; figure out if there’s some + * better magic than filtering out Caps- and Num-Lock here.. + */ + if (iswprint(utf32) && (effective & ~(1 << seat->kbd.mod_caps | + 1 << seat->kbd.mod_num)) == 0) + { + term_to_slave(term, utf8, count); + return; } unsigned int encoded_mods = 0; |
