From a20110661dcec56619a9e8984bdd0e104a54d982 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Wed, 9 May 2012 00:50:27 +0000 Subject: tlmgr gui: - fix for match disbalance wrt entry - fix behaviour wrt empty string git-svn-id: svn://tug.org/texlive/trunk@26266 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf/scripts/texlive/tlmgrgui.pl | 35 ++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 15 deletions(-) (limited to 'Master') diff --git a/Master/texmf/scripts/texlive/tlmgrgui.pl b/Master/texmf/scripts/texlive/tlmgrgui.pl index 8ccd655253e..da47d50f47c 100644 --- a/Master/texmf/scripts/texlive/tlmgrgui.pl +++ b/Master/texmf/scripts/texlive/tlmgrgui.pl @@ -125,6 +125,7 @@ my $show_schemes = 1; my $match_descriptions = 1; my $match_filenames = 1; my $match_taxonomies = 1; +my $match_text = ""; my $selection_value = 0; @@ -347,6 +348,7 @@ sub do_rest_of_gui { # $match_filenames = 1; # } # } + $match_text = $new_val; update_grid(); return 1; }); my $filter_selection = $filter_frame->Labelframe(-text => __("Selection")); @@ -842,8 +844,13 @@ sub update_grid { } else { @displist = (@schemes, @colls, @packs); } + my %match_hit; for my $p (@displist) { - if ($crit_match || MatchesFilters($p)) { + $match_hit{$p} = 1 if MatchesFilters($p); + } + my @match_keys = keys %match_hit; + for my $p (@displist) { + if ($crit_match || defined($match_hit{$p})) { if (defined($selectcode)) { $Packages{$p}{'selected'} = $selectcode; } @@ -912,20 +919,17 @@ sub MatchesFilters { # # match dealing # - # * some search targets selected, search string empty - # + search string empty - # -> show all packages - # + search string non-empty - # -> only show matching packages - # * no search target selected - # + search string empty - # -> show empty list (no warning) - # + search string non-empty + # * search string empty + # -> true + # * search string non-empty + # + some search targets selected + # -> check + # + no search target selected # -> show empty list (maybe show warning "select something") # if ($match_descriptions || $match_taxonomies || $match_filenames) { my $found = 0; - my $r = $match_entry->get; + my $r = $match_text; if ($r eq "") { return 1; } @@ -940,7 +944,7 @@ sub MatchesFilters { } } if (!$found) { - if ($match_taxonomies) { + if (defined($taxonomy) && $match_taxonomies) { if ($Packages{$p}{'taxonomy'} =~ m/$r/i) { $found = 1; } @@ -960,11 +964,12 @@ sub MatchesFilters { } # otherwise more checks have to be done } else { - my $r = $match_entry->get; - if ($r ne "") { + if ($match_text eq "") { + return 1; + } else { # we could give a warning "select something" but HOW??? + return 0; } - return 0 } # selection if ($selection_value == 0) { -- cgit v1.2.3