Ticket #1620: File hightlighting based on extension is case sensitive.

Added parameter extensions_case.

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
Slava Zanko 2009-10-03 00:26:27 +03:00
parent 93f8b96b32
commit 71642b9bdb
4 changed files with 19 additions and 9 deletions

View File

@ -3585,6 +3585,10 @@ regular expression. If present, 'extensions' option ignored
.TP .TP
.I extensions .I extensions
list of extensions of files. Separated by ';' sign. list of extensions of files. Separated by ';' sign.
.TP
.I extensions_case
(make sense only with 'extensions' parameter) make 'extensions'
rule case sentitive (true) or not (false).
.PP .PP
'type' key may have values: 'type' key may have values:
.nf .nf

View File

@ -3902,6 +3902,10 @@ base_color=normal=white,default:marked=magenta,default
.TP .TP
.I extensions .I extensions
Список расширений файлов. Раасширения разделяются символом ';'. Список расширений файлов. Раасширения разделяются символом ';'.
.TP
.I extensions_case
(имеет смысл только с параметром 'extensions') делает правило 'extensions'
чувствительным к регистру букв (true) или не чувтсвительным (false).
.PP .PP
Параметр 'type' (тип файла) может принимать значения: Параметр 'type' (тип файла) может принимать значения:
.nf .nf

View File

@ -10,7 +10,6 @@
[symlink] [symlink]
type=SYMLINK type=SYMLINK
[device] [device]
type=DEVICE type=DEVICE
@ -22,7 +21,8 @@
[temp] [temp]
extensions=tmp;$$$;~;bak extensions=tmp;$$$;~;bak
regexp=^#.* extensions_case=false
regexp=(^#.*|.*~$)
[archive] [archive]
extensions=gz;bz2;tar;tgz;rpm;Z;rar;zip;arj;cab;lzh;lha;zoo;arc;ark;xz;tbz;tbz2; extensions=gz;bz2;tar;tgz;rpm;Z;rar;zip;arj;cab;lzh;lha;zoo;arc;ark;xz;tbz;tbz2;

View File

@ -52,7 +52,7 @@ static void
mc_fhl_parse_fill_color_info (mc_fhl_filter_t * mc_filter, mc_fhl_t * fhl, const gchar * group_name) mc_fhl_parse_fill_color_info (mc_fhl_filter_t * mc_filter, mc_fhl_t * fhl, const gchar * group_name)
{ {
(void) fhl; (void) fhl;
mc_filter->color_pair_index = mc_skin_color_get("filehighlight", group_name); mc_filter->color_pair_index = mc_skin_color_get ("filehighlight", group_name);
} }
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
@ -162,7 +162,8 @@ mc_fhl_parse_get_extensions (mc_fhl_t * fhl, const gchar * group_name)
mc_filter = g_new0 (mc_fhl_filter_t, 1); mc_filter = g_new0 (mc_fhl_filter_t, 1);
mc_filter->type = MC_FLHGH_T_FREGEXP; mc_filter->type = MC_FLHGH_T_FREGEXP;
mc_filter->search_condition = mc_search_new (buf->str, -1); mc_filter->search_condition = mc_search_new (buf->str, -1);
mc_filter->search_condition->is_case_sentitive = TRUE; mc_filter->search_condition->is_case_sentitive =
mc_config_get_bool (fhl->config, group_name, "extensions_case", TRUE);
mc_filter->search_condition->search_type = MC_SEARCH_T_REGEX; mc_filter->search_condition->search_type = MC_SEARCH_T_REGEX;
mc_fhl_parse_fill_color_info (mc_filter, fhl, group_name); mc_fhl_parse_fill_color_info (mc_filter, fhl, group_name);
@ -247,21 +248,22 @@ mc_fhl_parse_ini_file (mc_fhl_t * fhl)
mc_fhl_array_free (fhl); mc_fhl_array_free (fhl);
fhl->filters = g_ptr_array_new (); fhl->filters = g_ptr_array_new ();
orig_group_names = group_names = orig_group_names = group_names = mc_config_get_groups (fhl->config, &ftype_names_size);
mc_config_get_groups (fhl->config, &ftype_names_size);
if (group_names == NULL) if (group_names == NULL)
return FALSE; return FALSE;
while (*group_names) { while (*group_names) {
if (mc_config_has_param (fhl->config, *group_names, "type")) { if (mc_config_has_param (fhl->config, *group_names, "type")) {
/* parse filetype filter */ /* parse filetype filter */
mc_fhl_parse_get_file_type_id (fhl, *group_names); mc_fhl_parse_get_file_type_id (fhl, *group_names);
} else if (mc_config_has_param (fhl->config, *group_names, "regexp")) { }
if (mc_config_has_param (fhl->config, *group_names, "regexp")) {
/* parse regexp filter */ /* parse regexp filter */
mc_fhl_parse_get_regexp (fhl, *group_names); mc_fhl_parse_get_regexp (fhl, *group_names);
} else if (mc_config_has_param (fhl->config, *group_names, "extensions")) { }
if (mc_config_has_param (fhl->config, *group_names, "extensions")) {
/* parse extensions filter */ /* parse extensions filter */
mc_fhl_parse_get_extensions (fhl, *group_names); mc_fhl_parse_get_extensions (fhl, *group_names);
} }