diff --git a/docs/keyboard-protocol.rst b/docs/keyboard-protocol.rst index 03c6a9fbe..5ac91d416 100644 --- a/docs/keyboard-protocol.rst +++ b/docs/keyboard-protocol.rst @@ -312,7 +312,7 @@ compatibility reasons. .. csv-table:: Functional key codes :header: "Name", "CSI sequence" - "ESCAPE", "CSI 57344 ... u" + "ESCAPE", "CSI 27 ... u" "ENTER", "CSI 13 ... u" "TAB", "CSI 9 ... u" "BACKSPACE", "CSI 127 ... u" diff --git a/gen-key-constants.py b/gen-key-constants.py index f46f90e39..2e31c164c 100644 --- a/gen-key-constants.py +++ b/gen-key-constants.py @@ -117,12 +117,12 @@ functional_encoding_overrides = { 'insert': 2, 'delete': 3, 'page_up': 5, 'page_down': 6, 'home': 7, 'end': 8, 'tab': 9, 'f1': 11, 'f2': 12, 'enter': 13, 'f4': 14, 'f5': 15, 'f6': 17, 'f7': 18, 'f8': 19, 'f9': 20, 'f10': 21, - 'f11': 23, 'f12': 24, 'backspace': 127 + 'f11': 23, 'f12': 24, 'escape': 27, 'backspace': 127 } different_trailer_functionals = { 'up': 'A', 'down': 'B', 'right': 'C', 'left': 'D', 'end': 'F', 'home': 'H', 'f1': 'P', 'f2': 'Q', 'f3': 'R', 'f4': 'S', 'enter': 'u', 'tab': 'u', - 'backspace': 'u' + 'backspace': 'u', 'escape': 'u' } functional_key_names: List[str] = [] name_to_code: Dict[str, int] = {} diff --git a/kitty/key_encoding.c b/kitty/key_encoding.c index 094fb1e3d..87523faf9 100644 --- a/kitty/key_encoding.c +++ b/kitty/key_encoding.c @@ -129,6 +129,7 @@ encode_function_key(const KeyEvent *ev, char *output) { #define S(number, trailer) key_number = number; csi_trailer = trailer; break switch(key_number) { /* start special numbers (auto generated by gen-key-constants.py do not edit) */ + case GLFW_FKEY_ESCAPE: S(27, 'u'); case GLFW_FKEY_ENTER: S(13, 'u'); case GLFW_FKEY_TAB: S(9, 'u'); case GLFW_FKEY_BACKSPACE: S(127, 'u');