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.
This commit is contained in:
Daniel Eklöf 2021-11-21 11:38:36 +01:00
parent db746d72ed
commit e744cee760
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

19
input.c
View file

@ -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 theres 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;