diff options
author | pierre <pierre@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2007-01-22 04:32:07 +0000 |
---|---|---|
committer | pierre <pierre@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2007-01-22 04:32:07 +0000 |
commit | b6ca87941c9db15816417b4f33fc45a96d4d0aa6 (patch) | |
tree | 61c7dd8aab1faa14753385a5168d91a4f67305a6 /ide/whelp.pas | |
parent | 3854f0a29f9c52a481f18f3c92cf2a7515ec2be2 (diff) | |
download | fpc-b6ca87941c9db15816417b4f33fc45a96d4d0aa6.tar.gz |
* on CtrlF1, first do an exact name search, only allow longer names if exact is not found
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@6126 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'ide/whelp.pas')
-rw-r--r-- | ide/whelp.pas | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/ide/whelp.pas b/ide/whelp.pas index b63d7e6ab2..0e31407fb7 100644 --- a/ide/whelp.pas +++ b/ide/whelp.pas @@ -833,6 +833,18 @@ end; function THelpFacility.TopicSearch(Keyword: string; var FileID: word; var Context: THelpCtx): boolean; +function ScanHelpFileExact(H: PHelpFile): boolean; {$ifndef FPC}far;{$endif} +function SearchExact(P: PIndexEntry): boolean; {$ifndef FPC}far;{$endif} +begin + SearchExact:=UpcaseStr(P^.Tag^)=Keyword; +end; +var P: PIndexEntry; +begin + H^.LoadIndex; + P:=H^.IndexEntries^.FirstThat(@SearchExact); + if P<>nil then begin FileID:=H^.ID; Context:=P^.HelpCtx; end; + ScanHelpFileExact:=P<>nil; +end; function ScanHelpFile(H: PHelpFile): boolean; {$ifndef FPC}far;{$endif} function Search(P: PIndexEntry): boolean; {$ifndef FPC}far;{$endif} begin @@ -845,9 +857,14 @@ begin if P<>nil then begin FileID:=H^.ID; Context:=P^.HelpCtx; end; ScanHelpFile:=P<>nil; end; +var + PH : PHelpFile; begin Keyword:=UpcaseStr(Keyword); - TopicSearch:=HelpFiles^.FirstThat(@ScanHelpFile)<>nil; + PH:=HelpFiles^.FirstThat(@ScanHelpFileExact); + if not assigned(PH) then + PH:=HelpFiles^.FirstThat(@ScanHelpFile); + TopicSearch:=PH<>nil; end; function THelpFacility.BuildIndexTopic: PTopic; |