diff --git a/src/ls.c b/src/ls.c index 680679a..4cfb7c7 100644 --- a/src/ls.c +++ b/src/ls.c @@ -1149,6 +1149,17 @@ restore_default_color (void) put_indicator (&color_indicator[C_RIGHT]); } +static void +set_normal_color (void) +{ + if (color_indicator[C_NORM].string != NULL) + { + put_indicator (&color_indicator[C_LEFT]); + put_indicator (&color_indicator[C_NORM]); + put_indicator (&color_indicator[C_RIGHT]); + } +} + /* An ordinary signal was received; arrange for the program to exit. */ static void @@ -3444,6 +3455,8 @@ print_current_files (void) case long_format: for (i = 0; i < cwd_n_used; i++) { + if (print_with_color) + set_normal_color (); print_long_format (sorted_file[i]); DIRED_PUTCHAR ('\n'); } @@ -4048,6 +4061,9 @@ print_file_name_and_frills (const struct fileinfo *f, size_t start_col) { char buf[MAX (LONGEST_HUMAN_READABLE + 1, INT_BUFSIZE_BOUND (uintmax_t))]; + if (print_with_color) + set_normal_color (); + if (print_inode) printf ("%*s ", format == with_commas ? 0 : inode_number_width, format_inode (buf, sizeof buf, f));