osc: use four digits in OSC-4 and OSC-11 rgb:r/g/b replies

Closes #971
This commit is contained in:
Daniel Eklöf 2022-03-13 09:05:55 +01:00
parent 2a4e7fde8d
commit 3cefe78b40
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 8 additions and 4 deletions

View file

@ -54,6 +54,8 @@
(https://codeberg.org/dnkl/foot/issues/922).
* Support for re-mapping input, i.e. mapping input to custom escape
sequences (https://codeberg.org/dnkl/foot/issues/325).
* OSC-4 and OSC-11 replies now uses four digits instead of 2
(https://codeberg.org/dnkl/foot/issues/971).
### Deprecated

10
osc.c
View file

@ -596,8 +596,9 @@ osc_dispatch(struct terminal *term)
char reply[32];
size_t n = xsnprintf(
reply, sizeof(reply), "\033]4;%u;rgb:%02x/%02x/%02x%s",
idx, r, g, b, terminator);
reply, sizeof(reply),
"\033]4;%u;rgb:%02hhx%02hhx/%02hhx%02hhx/%02hhx%02hhx%s",
idx, r, r, g, g, b, b, terminator);
term_to_slave(term, reply, n);
}
@ -695,8 +696,9 @@ osc_dispatch(struct terminal *term)
*/
char reply[32];
size_t n = xsnprintf(
reply, sizeof(reply), "\033]%u;rgb:%02x/%02x/%02x%s",
param, r, g, b, terminator);
reply, sizeof(reply),
"\033]%u;rgb:%02hhx%02hhx/%02hhx%02hhx/%02hhx%02hhx%s",
param, r, r, g, g, b, b, terminator);
term_to_slave(term, reply, n);
break;