From 483297d5ddaea930d61da1da9c3f052cbd3c3810 Mon Sep 17 00:00:00 2001 From: Ed Avis Date: Tue, 12 Feb 2008 12:22:35 +0100 Subject: ls --color no longer outputs unnecessary escape sequences In --color mode, plain files do not get any color, not even white. When no highlighting is required, ls outputs no escape sequence at all. * src/ls.c (print_with_color): (used_color): New global. (indicator_no) [C_RESET]: New enum value. (indicator_name) ["rs"]: Corresponding new string. (color_indicator): Make the 'normal' and 'file' markers be NULL. Use "rs" (C_RESET) to reset to ordinary colors. (process_signals): Restore default colors only if necessary. (main): Don't call prep_non_filename_text here. (print_name_with_quoting): Call it here, instead. (prep_non_filename_text): Use C_RESET, not C_NORM. (print_color_indicator): Return bool, not void. Print nothing, when possible. (put_indicator): Call prep_non_filename_text the first time. * tests/misc/ls-misc: Test for above. * tests/ls/color-dtype-dir: Adapt: no escapes around regular file name. * TODO: Remove item. * NEWS: Mention this. --- tests/ls/color-dtype-dir | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/ls') diff --git a/tests/ls/color-dtype-dir b/tests/ls/color-dtype-dir index 7a25c06d3..b96970162 100755 --- a/tests/ls/color-dtype-dir +++ b/tests/ls/color-dtype-dir @@ -4,7 +4,7 @@ # directories the same as the first one -- but only on a file system # with dirent.d_type support. -# Copyright (C) 2006-2007 Free Software Foundation, Inc. +# Copyright (C) 2006-2008 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -43,7 +43,7 @@ mv o1 out || fail=1 cat <<\EOF > exp || fail=1 ^[[0m^[[01;34md^[[0m$ ^[[34;42mother-writable^[[0m$ -^[[0mout^[[0m$ +out$ ^[[37;44msticky^[[0m$ ^[[m EOF -- cgit v1.2.3-70-g09d2