diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2023-07-13 15:22:42 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2023-07-13 16:02:56 -0400 |
commit | c5a2bfd924445dfccd943ea34374a5d1266f5cb9 (patch) | |
tree | 107939d8c2b35a799a23ae6806f62c98ad6efcc9 /src/color.c | |
parent | b577bedfd37d93cb802c36beb93cf6581af51930 (diff) | |
download | bfs-c5a2bfd924445dfccd943ea34374a5d1266f5cb9.tar.xz |
color: TTY-escape filenames
Diffstat (limited to 'src/color.c')
-rw-r--r-- | src/color.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/color.c b/src/color.c index 00d7920..6593f5b 100644 --- a/src/color.c +++ b/src/color.c @@ -922,9 +922,12 @@ static int print_colored(CFILE *cfile, const struct esc_seq *esc, const char *st if (print_esc(cfile, esc) != 0) { return -1; } - if (dstrxcat(&cfile->buffer, str, len) != 0) { + + // Don't let the string itself interfere with the colors + if (print_wordesc(cfile, str, len, WESC_TTY) != 0) { return -1; } + if (print_reset(cfile) != 0) { return -1; } @@ -1242,6 +1245,11 @@ static int cvbuff(CFILE *cfile, const char *format, va_list args) { return -1; } break; + case 'Q': + if (print_wordesc(cfile, va_arg(args, const char *), SIZE_MAX, WESC_TTY) != 0) { + return -1; + } + break; case 'F': if (print_name(cfile, va_arg(args, const struct BFTW *)) != 0) { |