>From 733093f4808a9a2623e55b65615276e5cca1de90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Droz?= Date: Tue, 31 May 2011 01:10:04 +0200 Subject: [PATCH 5/6] Colored completion, LS_COLORS handling (5/6) Runs rl_parse_colors() at readline initialization. It builds the _rl_color_ext_list structure which allows colors to not only depends on file type (dir, sock, fifo, ...) but also on filename extensions, according to $LS_COLORS. See DIR_COLORS(5) for more information. --- lib/readline/readline.c | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/lib/readline/readline.c b/lib/readline/readline.c index f2e4d93..afd76f0 100644 --- a/lib/readline/readline.c +++ b/lib/readline/readline.c @@ -279,6 +279,11 @@ int _rl_revert_all_at_newline = 0; characters corresponding to keyboard-generated signals. */ int _rl_echo_control_chars = 1; +/* The content of $LS_COLORS as parsed by rl_parse_colors() */ +#if defined (COLORED_STATS) +COLOR_EXT_TYPE *_rl_color_ext_list = NULL; +#endif + /* **************************************************************** */ /* */ /* Top Level Functions */ @@ -1099,6 +1104,14 @@ readline_initialize_everything () been set yet, then do so now. */ if (rl_completer_word_break_characters == (char *)NULL) rl_completer_word_break_characters = (char *)rl_basic_word_break_characters; + +#ifdef COLORED_STATS + /* This adds colors from $LS_COLORS to filename completion. + This function depends on rl_colored_stats == 1 + (this initialization is done by rl_read_init_file() above). */ + if(rl_colored_stats) + rl_parse_colors (); +#endif } /* If this system allows us to look at the values of the regular -- 1.7.3.4