diff options
Diffstat (limited to 'Master/texmf')
-rw-r--r-- | Master/texmf/scripts/texlive/tlmgrgui.pl | 65 |
1 files changed, 49 insertions, 16 deletions
diff --git a/Master/texmf/scripts/texlive/tlmgrgui.pl b/Master/texmf/scripts/texlive/tlmgrgui.pl index 6467e9d5750..8cc71646e66 100644 --- a/Master/texmf/scripts/texlive/tlmgrgui.pl +++ b/Master/texmf/scripts/texlive/tlmgrgui.pl @@ -109,7 +109,8 @@ my $status_value = 0; my $show_packages = 1; my $show_collections = 1; my $show_schemes = 1; -my $match_string = 0; +my $match_descriptions = 0; +my $match_filenames = 0; my $selection_value = 0; @@ -297,9 +298,12 @@ sub do_rest_of_gui { my $filter_match = $filter_frame->Labelframe(-text => __("Match")); $filter_match->pack(@left, @x_y, @p_ii); - $filter_match->Checkbutton(-text => __("pattern:"), + $filter_match->Checkbutton(-text => __("filenames"), -command => \&update_grid, - -variable => \$match_string)->pack(@a_w); + -variable => \$match_filenames)->pack(@a_w); + $filter_match->Checkbutton(-text => __("descriptions"), + -command => \&update_grid, + -variable => \$match_descriptions)->pack(@a_w); $match_entry = $filter_match->Entry(-width => 15, -validate => 'key', )->pack(@a_w, -padx => '2m', @x_x); @@ -307,9 +311,9 @@ sub do_rest_of_gui { $match_entry->configure(-validate => 'key', -validatecommand => sub { my $new_val = shift; if (!$new_val) { - $match_string = 0; + $match_descriptions = 0; } else { - $match_string = 1; + $match_descriptions = 1; } update_grid(); return 1; }); @@ -339,7 +343,7 @@ sub do_rest_of_gui { $show_packages = 1; $show_collections = 1; $show_schemes = 1; $selection_value = 0; - $match_string = 0; + $match_descriptions = 0; update_grid(); })->pack(@x_x, @a_c); @@ -831,19 +835,48 @@ sub MatchesFilters { } else { return 0; } - # match - if ($match_string) { + # + # match dealing + # here we have an "or" condition, either it matches the one or the + # other, so since we are in negative branch returning 0 we have to + # make sure that we negate the value + # (sorry if you don't understand that one, I had some Sake) + # + # SPECIAL: If neiter description matching nor file name matching is + # selected, we do NOT do any checks at all. Somehow that is what + # feels right to me, but please correct me! + if ($match_descriptions || $match_filenames) { + my $found = 0; my $r = $match_entry->get; - # check for match on string - my $t = $Packages{$p}{'tlp'}->shortdesc; - $t |= ""; - my $lt = $Packages{$p}{'tlp'}->longdesc; - $lt |= ""; - if (($p =~ m/$r/) || ($t =~ m/$r/) || ($lt =~ m/$r/)) { - # do nothing, more checks have to be done - } else { + # check first for the default search type, the descriptions + if ($match_descriptions) { + # normal case, match descriptions + my $t = $Packages{$p}{'tlp'}->shortdesc; + $t |= ""; + my $lt = $Packages{$p}{'tlp'}->longdesc; + $lt |= ""; + if (($p =~ m/$r/) || ($t =~ m/$r/) || ($lt =~ m/$r/)) { + $found = 1; + } + } + # if we already dound, don't check the next condition! + if (!$found) { + if ($match_filenames) { + my @files = $Packages{$p}{'tlp'}->all_files; + if ($Packages{$p}{'tlp'}->relocated) { + for (@files) { s:^$RelocPrefix/:$RelocTree/:; } + } + my @ret = grep(m;$r;, @files); + if (@ret) { + $found = 1; + } + } + } + if (!$found) { + # not matched in either of the above cases, return 0 immediately return 0; } + # otherwise more checks have to be done } # selection if ($selection_value == 0) { |