osc: fix 'OSC 12 ?' to return the cursor color, not the cursor text color

This commit is contained in:
Daniel Eklöf 2020-05-02 22:58:30 +02:00
parent ac58d05c6b
commit db9b99e8ac
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 5 additions and 3 deletions

View file

@ -64,6 +64,8 @@
* Memory leak in terminal reset.
* Translation of cursor coordinates on resize
* Scaling of legacy formatted color specifiers in OSC sequences.
* `OSC 12 ?` to return the cursor color, not the cursor's text color.
### Security

6
osc.c
View file

@ -525,9 +525,9 @@ osc_dispatch(struct terminal *term)
/* Client queried for current value */
if (strlen(string) == 1 && string[0] == '?') {
uint8_t r = (term->cursor_color.text >> 16) & 0xff;
uint8_t g = (term->cursor_color.text >> 8) & 0xff;
uint8_t b = (term->cursor_color.text >> 0) & 0xff;
uint8_t r = (term->cursor_color.cursor >> 16) & 0xff;
uint8_t g = (term->cursor_color.cursor >> 8) & 0xff;
uint8_t b = (term->cursor_color.cursor >> 0) & 0xff;
char reply[32];
snprintf(reply, sizeof(reply), "\033]12;rgb:%02x/%02x/%02x\033\\", r, g, b);