aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2022-03-13 08:05:55 +0000
committerDaniel Eklöf <daniel@ekloef.se>2022-03-13 18:44:32 +0000
commit3cefe78b40b6210dd1991989b800344813c9bd85 (patch)
treedaa8340b621377427f381de57efca6bf2af8ecca
parentMerge branch 'osc-buffer-growth' (diff)
osc: use four digits in OSC-4 and OSC-11 rgb:r/g/b replies
Closes #971
-rw-r--r--CHANGELOG.md2
-rw-r--r--osc.c10
2 files changed, 8 insertions, 4 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8f523d5f..5d05d403 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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
diff --git a/osc.c b/osc.c
index 94b6892c..5d04910b 100644
--- a/osc.c
+++ b/osc.c
@@ -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;