Subject: bug#54027: Wishlist: Support full CSI u specification for terminal input

From: Alex Hutcheson <[email-masked]>
Date: Wed, 16 Feb 2022 18:24:13 +0000

CSI u is a mechanism for reporting keystrokes that is more powerful than
the standard used in Unix.

The specification is detailed at:
http://www.leonerd.org.uk/hacks/fixterms/

The specification is implemented by iTerm2, which is a popular
GPL-licensed terminal for macOS:
https://iterm2.com/documentation-csiu.html

A variant of the specification is implemented by kitty, another
GPL-licensed terminal on Linux and macOS:
https://sw.kovidgoyal.net/kitty/keyboard-protocol/#comprehensive-keyboard-handling-in-terminals

The GPL-licensed mintty terminal for Windows also has support:
https://github.com/mintty/mintty/wiki/Keycodes

Emacs contains code in xterm.el that can handle a subset of the possible
key combinations encoded to this specification, but not all of them.
For example, iTerm2 is able to send an encoding for Ctrl-Shift-n (aka
C-N),
but Emacs is unable to recognized the CSI u encoding for this key
combination.

My feature request is to implement full support for the encoding, so
that users using a supported terminal can send the full range of
key combinations to an Emacs running in a terminal.

Additional context: https://emacs.stackexchange.com/a/13957