> kitty is a problematic terminal emulator, from the POV of an Emacs
Thanks for the context - I wasn't aware. We can forget about kitty then.
I've done a bit more research and realized that xterm also supports this
encoding. It just requires the formatOtherKeys setting to be enabled.
A couple links I found useful:
- A detailed overview of the issue from the maintainer of xterm.
This covers both the original "CSI 27" encoding and the newer
I also realized that this has actually been discussed in the past,
and Emacs actually added support for many CSI u sequences to
I think the only remaining work is to extend that support to cover
all reasonable combinations of modifiers and keys, which is what
the code snippet in the StackExchange answer attempts to do.
We're currently hard-coding the possible combinations of
modifiers and keys that we support:
An alternative approach would be to replace that hard-coded list
with a programatically-generated list that includes every combination
of modifiers and keys.