From a0cee1365279fc952cf872d4e4ae1cd1344851f1 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 29 Sep 2021 11:12:01 +0530 Subject: [PATCH] Also turn on extended key reporting for CSI > 4; 2 m This is supported by XTerm and used by vim. Fixes #4075 --- docs/keyboard-protocol.rst | 8 +++++--- kitty/screen.c | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/keyboard-protocol.rst b/docs/keyboard-protocol.rst index 720009c34..991671d05 100644 --- a/docs/keyboard-protocol.rst +++ b/docs/keyboard-protocol.rst @@ -278,9 +278,11 @@ oldest entry from the stack must be evicted. screen is and restore to that mode on exit. .. note:: In the interests of interoperation, the XTerm specific sequences - `CSI > 4; 1 m` and `CSI > 4; 0 m` are treated as `CSI > 1 u` and `CSI < 1 u`. - These codes cause XTerm to use the CSI u encoding for more keys and are therefore - treated as similar to the disambiguate progressive enhancement. + ``CSI > 4; x m` and `CSI > 4; 0 m` are treated as `CSI > 1 u` and `CSI < 1 u`. + Here `x` can be either `1` or `2`. These codes cause XTerm to use the CSI u + encoding for more keys and are therefore treated as similar to the disambiguate + progressive enhancement. + .. _disambiguate: diff --git a/kitty/screen.c b/kitty/screen.c index 82eb6dfba..07e4a6aaa 100644 --- a/kitty/screen.c +++ b/kitty/screen.c @@ -1066,7 +1066,7 @@ screen_xtmodkeys(Screen *self, uint32_t p1, uint32_t p2) { // https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h4-Functions-using-CSI-_-ordered-by-the-final-character-lparen-s-rparen:CSI-gt-Pp-m.1DB2 // we handle them as being equivalent to push and pop 1 onto the keyboard stack if ((!p1 && !p2) || (p1 == 4 && p2 == 0)) screen_pop_key_encoding_flags(self, 1); - else if (p1 == 4 && p2 == 1) screen_push_key_encoding_flags(self, 1); + else if (p1 == 4 && (p2 == 1 || p2 == 2)) screen_push_key_encoding_flags(self, 1); }