kitty: implement “report associated text”

In this mode, key events that generate text now add a third CSI
parameter, indicating the actual codepoint.

Remember that we always use the *unshifted* key in the CSI
escapes. With this mode, those CSI escapes now also included the text
codepoint. I.e. what would have been emitted, had we not generated a
CSI escape.

As far as I can tell, this mode has no effect unless “report all keys
as escape sequences” is enabled (reason being, without that, there
aren’t any text events that generate CSIs - they’re always emitted
as-is).

Note that Kitty itself seems to be somewhat buggy in this mode. At
least on Wayland, with my Swedish layout. For example ‘a’ and ‘A’ does
generate the expected CSIs, but ‘å’ and ‘Å’ appears to be treated as
non-text input.

Furthermore, Kitty optimizes away the modifier parameter, if no
modifiers are pressed (e.g. CSI 97;;97u), while we always emit the
modifier (CSI 97;1;97u).

Related to #319
This commit is contained in:
Daniel Eklöf 2021-12-06 23:01:41 +01:00
parent 9649842eca
commit 7a5386d883
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
3 changed files with 40 additions and 18 deletions

View file

@ -135,7 +135,8 @@ enum kitty_kbd_flags {
KITTY_KBD_REPORT_ASSOCIATED = 0x10,
KITTY_KBD_SUPPORTED = (KITTY_KBD_DISAMBIGUATE |
KITTY_KBD_REPORT_EVENT |
KITTY_KBD_REPORT_ALL),
KITTY_KBD_REPORT_ALL |
KITTY_KBD_REPORT_ASSOCIATED),
};
struct grid {