summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManuel Pégourié-Gonnard <mpg@elzevir.fr>2010-04-05 08:09:03 +0000
committerManuel Pégourié-Gonnard <mpg@elzevir.fr>2010-04-05 08:09:03 +0000
commit2ebb2c00777045cd4da1c1c46e82853e77e86ea2 (patch)
tree4536ae193754ae53b33997acd00c08e68c5795e5
parent84991d1a6e92a6f9debbfc00d20ce5e071490350 (diff)
Move actual search code to a subroutine.
git-svn-id: svn://tug.org/texlive/trunk@17702 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-xMaster/texmf/scripts/tetex/texdoctk.pl35
1 files changed, 22 insertions, 13 deletions
diff --git a/Master/texmf/scripts/tetex/texdoctk.pl b/Master/texmf/scripts/tetex/texdoctk.pl
index 25352c9193e..f0512882ba7 100755
--- a/Master/texmf/scripts/tetex/texdoctk.pl
+++ b/Master/texmf/scripts/tetex/texdoctk.pl
@@ -784,13 +784,30 @@ sub mksrch {
}
}
-# search a string in @packname, @topic and @keywords
+# call search routine and display results
sub srchstr {
- my ($i,$j,$string);
- my (@results,@reslist);
+ my $string;
+ my @reslist;
$main->configure(-cursor=>'watch');
$string=$srchentry->get();
# search
+ @reslist = &srchdb($string);
+# destroy entry widget and show results
+ destroy $srchentry;
+ $srchflag=0;
+ if (scalar @reslist == 0) {
+ &popmsg(0,"Search for $string: no matches found.\n".
+ "Try `texdoc $string' in a command line.",$cmdframe);
+ } else {
+ &tpslct(-1, $string, @reslist);
+ }
+ $main->configure(-cursor=>$defcursor);
+}
+
+# search a string in @packname, @topic and @keywords
+sub srchdb {
+ my ($string) = @_;
+ my (@results, @reslist);
if ($string) {
for ($i=0; $i<$ncat; ++$i) {
for ($j=0; $j<$maxind[$i]+1; ++$j) {
@@ -818,13 +835,7 @@ sub srchstr {
for ($j=0; $j<$maxind[$i]+1; ++$j) { push @results,($i,$j); }
}
}
-# destroy entry widget and show results
- destroy $srchentry;
- $srchflag=0;
- if (scalar @results == 0) {
- &popmsg(0,"Search for $string: no matches found.\n".
- "Try `texdoc $string' in a command line.",$cmdframe);
- } else {
+ unless (scalar @results == 0) {
# cancel multiple entries
my ($omit,$pack1,$pack2);
@reslist=($results[0],$results[1]);
@@ -837,10 +848,8 @@ sub srchstr {
}
if ($omit == 0) { push @reslist,($results[$i],$results[$i+1]); }
}
- unshift @reslist,$string;
- &tpslct(-1,@reslist);
}
- $main->configure(-cursor=>$defcursor);
+ return @reslist;
}
# extract documentation of .sty files; a flag in the @keywords array shows