From 24c315e9113b85c498915b37b2363308c340492e Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 16 Jan 2026 22:29:04 +0100 Subject: [PATCH 1/2] ansi-color: convert one more ANSI sequence from ";" to ":" separators This is a follow-up for 6eabe9f2ff48c1b6924724d5afe64e7b661ccdbf where one sequence was forgotten. --- src/basic/ansi-color.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/basic/ansi-color.h b/src/basic/ansi-color.h index d8620c0f52..c9348cad25 100644 --- a/src/basic/ansi-color.h +++ b/src/basic/ansi-color.h @@ -49,7 +49,7 @@ bool looks_like_ansi_color_code(const char *str); #define ANSI_BRIGHT_CYAN "\x1B[0;96m" #define ANSI_BRIGHT_WHITE "\x1B[0;97m" -#define ANSI_GREY "\x1B[0;38;5;245m" +#define ANSI_GREY "\x1B[0;38:5:245m" /* Bold/highlighted */ #define ANSI_HIGHLIGHT_BLACK "\x1B[0;1;30m" From e09b5366e57cbe06c32a7607236e1383a2e4d533 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 16 Jan 2026 22:29:40 +0100 Subject: [PATCH 2/2] 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 0c5c0a6287..ecd0277577 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);