From adc9b3f6cf7f1072f450855c4be3f8d767f70712 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 8 Apr 2025 09:15:31 +0530 Subject: [PATCH] When issuing a DECRPSS report for SGR use a leading 0 This matches historical DEC terminal behavior. --- kitty/screen.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kitty/screen.c b/kitty/screen.c index cc504b639..8cfc818bd 100644 --- a/kitty/screen.c +++ b/kitty/screen.c @@ -2994,7 +2994,9 @@ screen_request_capabilities(Screen *self, char c, const char *query) { shape = snprintf(buf, sizeof(buf), "1$r%d q", shape); } else if (strcmp("m", query) == 0) { // SGR - shape = snprintf(buf, sizeof(buf), "1$r%sm", cursor_as_sgr(self->cursor)); + const char *s = cursor_as_sgr(self->cursor); + if (s && s[0]) shape = snprintf(buf, sizeof(buf), "1$r0;%sm", s); + else shape = snprintf(buf, sizeof(buf), "1$r0m"); } else if (strcmp("r", query) == 0) { // DECSTBM shape = snprintf(buf, sizeof(buf), "1$r%u;%ur", self->margin_top + 1, self->margin_bottom + 1); } else if (strcmp("*x", query) == 0) { // DECSACE