util: two fixes regarding ansi color handling (#40366)

This commit is contained in:
Mike Yuan
2026-01-17 14:57:35 +01:00
committed by GitHub
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -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"
+1 -1
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);