summaryrefslogtreecommitdiff
path: root/Master/texmf/scripts/tetex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf/scripts/tetex')
-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