From d6a43a7729d50b6f452ccdb93c746b0e115ebd38 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 1 Oct 2021 21:26:27 +0530 Subject: [PATCH] Dont turn on disambiguate keys when receiving th XTMODKEYS escape code See #4075 --- docs/changelog.rst | 5 +++++ docs/keyboard-protocol.rst | 7 ------- kitty/parser.c | 6 +++++- kitty/screen.c | 10 ---------- kitty/screen.h | 1 - 5 files changed, 10 insertions(+), 19 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 9e86d131c..bff8dd377 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -69,6 +69,11 @@ To update |kitty|, :doc:`follow the instructions `. applying to all windows, not just the initially created ones. Note that ``--watcher`` now also applies to all windows, not just initially created ones. +- **Backward incompatibility**: No longer turn on the kitty extended keyboard + protocol's disambiguate mode when the client sends the XTMODKEYS escape code. + Applications must use the dedicated escape code to turn on the protocol. + (:iss:`4075`) + 0.23.1 [2021-08-17] ---------------------- diff --git a/docs/keyboard-protocol.rst b/docs/keyboard-protocol.rst index 29a900186..6d1f54429 100644 --- a/docs/keyboard-protocol.rst +++ b/docs/keyboard-protocol.rst @@ -277,13 +277,6 @@ oldest entry from the stack must be evicted. the editor would have to somehow know what the keyboard mode of the main screen is and restore to that mode on exit. -.. note:: In the interests of interoperation, the XTerm specific sequences - ``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: Disambiguate escape codes diff --git a/kitty/parser.c b/kitty/parser.c index c7813facc..93c7ffcbf 100644 --- a/kitty/parser.c +++ b/kitty/parser.c @@ -998,7 +998,11 @@ dispatch_csi(Screen *screen, PyObject DUMP_UNUSED *dump_callback) { break; case 'm': if (start_modifier == '>' && !end_modifier) { - CALL_CSI_HANDLER2(screen_xtmodkeys, 0, 0); + REPORT_ERROR( + "The application is trying to use XTerm's modifyOtherKeys." + " This is superseded by the kitty keyboard protocol: https://sw.kovidgoyal.net/kitty/keyboard-protocol/" + " the application should be updated to use that" + ); break; } /* fallthrough */ diff --git a/kitty/screen.c b/kitty/screen.c index 3e30f2ec7..ebc8d4021 100644 --- a/kitty/screen.c +++ b/kitty/screen.c @@ -1062,16 +1062,6 @@ screen_pop_key_encoding_flags(Screen *self, uint32_t num) { } } -void -screen_xtmodkeys(Screen *self, uint32_t p1, uint32_t p2) { - // this is the legacy XTerm escape code for modify keys - // 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 || p2 == 2)) screen_push_key_encoding_flags(self, 1); -} - - // }}} // Cursor {{{ diff --git a/kitty/screen.h b/kitty/screen.h index 49c8f4480..c9e3f3c8e 100644 --- a/kitty/screen.h +++ b/kitty/screen.h @@ -240,7 +240,6 @@ void screen_push_key_encoding_flags(Screen *self, uint32_t val); void screen_pop_key_encoding_flags(Screen *self, uint32_t num); uint8_t screen_current_key_encoding_flags(Screen *self); void screen_report_key_encoding_flags(Screen *self); -void screen_xtmodkeys(Screen *self, uint32_t p1, uint32_t p2); bool screen_detect_url(Screen *screen, unsigned int x, unsigned int y); int screen_cursor_at_a_shell_prompt(const Screen *); bool screen_fake_move_cursor_to_position(Screen *, index_type x, index_type y);