From 518e06cfa46da410ac69575d91ca5382c9ada402 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 25 Aug 2025 15:30:36 +0530 Subject: [PATCH] Also report -2 in query response --- docs/multiple-cursors-protocol.rst | 13 +++++++------ kitty/screen.c | 2 +- kitty_tests/screen.py | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/docs/multiple-cursors-protocol.rst b/docs/multiple-cursors-protocol.rst index 25c7b8da4..2a69ecd6c 100644 --- a/docs/multiple-cursors-protocol.rst +++ b/docs/multiple-cursors-protocol.rst @@ -92,13 +92,14 @@ protocol by sending the escape code:: In this case a supporting terminal must reply with:: - CSI > -1;1;2;3 TRAILER + CSI > -2;-1;1;2;3 TRAILER -Here, the list of numbers indicates the cursor shapes the terminal supports and -can be any subset of the above. No numbers indicates the protocol is not -supported. To avoid having to wait with a timeout for a response from the -terminal, the client should send this query code immediately followed by -a request for the `primary device attributes `_. +Here, the list of numbers indicates the cursor shapes and other operations +the terminal supports and can be any subset of the above. No numbers +indicates the protocol is not supported. To avoid having to wait with a +timeout for a response from the terminal, the client should send this +query code immediately followed by a request for the +`primary device attributes `_. If the terminal responds with an answer for the device attributes without an answer for the *query* the terminal emulator does not support this protocol at all. diff --git a/kitty/screen.c b/kitty/screen.c index f5c660016..896df3d03 100644 --- a/kitty/screen.c +++ b/kitty/screen.c @@ -2871,7 +2871,7 @@ screen_multi_cursor(Screen *self, int queried_shape, int *params, unsigned num_p // printf("%d;", queried_shape); for (unsigned i = 0; i < num_params; i++) {printf("%d:", params[i]);} printf("\n"); if (!num_params) { if (params == NULL) { - write_escape_code_to_child(self, ESC_CSI, ">-1;1;2;3 q"); + write_escape_code_to_child(self, ESC_CSI, ">-2;-1;1;2;3 q"); } else if (queried_shape == -2) { size_t sz = self->extra_cursors.count * 32 + 64; RAII_ALLOC(char, buf, malloc(sz)); sz -= 4; diff --git a/kitty_tests/screen.py b/kitty_tests/screen.py index 5dd28c42d..8d7d707b6 100644 --- a/kitty_tests/screen.py +++ b/kitty_tests/screen.py @@ -1595,7 +1595,7 @@ class TestScreen(BaseTest): c = s.callbacks # Test detection parse_bytes(s, b'\x1b[> q') # ] - self.ae(c.wtcbuf, b'\x1b[>-1;1;2;3 q') # ] + self.ae(c.wtcbuf, b'\x1b[>-2;-1;1;2;3 q') # ] def current() -> dict[int, tuple[int, int]]: ans = {}