When issuing a DECRPSS report for SGR use a leading 0

This matches historical DEC terminal behavior.
This commit is contained in:
Kovid Goyal 2025-04-08 09:15:31 +05:30
parent f918ecce28
commit adc9b3f6cf
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C

View file

@ -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