From e09b5366e57cbe06c32a7607236e1383a2e4d533 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 16 Jan 2026 22:29:40 +0100 Subject: [PATCH] string-util: accept ":" when stripping ANSI color sequences Since 6eabe9f2ff48c1b6924724d5afe64e7b661ccdbf we generate sequences with ":", hence we better also know how to strip them. (Without this patch we'd strip simple ANSI colors, but not RGB ones that use ":" syntax). (While we are at it, also drop a duplicate "0" in the list of valid chars) --- src/basic/string-util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/basic/string-util.c b/src/basic/string-util.c index 0c5c0a62872..ecd0277577d 100644 --- a/src/basic/string-util.c +++ b/src/basic/string-util.c @@ -735,7 +735,7 @@ char* strip_tab_ansi(char **ibuf, size_t *_isz, size_t highlight[2]) { case STATE_CSI: assert(n_carriage_returns == 0); - if (eot || !strchr("01234567890;m", *i)) { /* EOT or invalid chars in sequence */ + if (eot || !strchr(DIGITS ";:m", *i)) { /* EOT or invalid chars in sequence */ fputc('\x1B', f); fputc('[', f); advance_offsets(i - *ibuf, highlight, shift, 2); -- 2.47.3