string-util: accept ":" when stripping ANSI color sequences

Since 6eabe9f2ff 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)
This commit is contained in:
Lennart Poettering
2026-01-16 22:29:40 +01:00
parent 24c315e911
commit e09b5366e5

View File

@@ -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);