From d665e635e2dde51d8c21a9728950186821bf81d1 Mon Sep 17 00:00:00 2001 From: mattias Date: Tue, 14 Jun 2011 15:05:13 +0000 Subject: [PATCH] IDE: code hints: add title description git-svn-id: trunk@31220 - --- ide/codehelp.pas | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/ide/codehelp.pas b/ide/codehelp.pas index 469066e977..42912ae6d0 100644 --- a/ide/codehelp.pas +++ b/ide/codehelp.pas @@ -348,6 +348,7 @@ function CompareAnsistringWithLDSrc2DocSrcFile(Key, Data: Pointer): integer; function ToUnixLineEnding(const s: String): String; function ToOSLineEnding(const s: String): String; function ReplaceLineEndings(const s, NewLineEnds: string): string; +function AppendLineEnding(const s: string): string; // append if not empty and there is not already a line ending implementation @@ -431,6 +432,13 @@ begin end; end; +function AppendLineEnding(const s: string): string; +begin + Result:=s; + if (Result='') or (Result[length(Result)] in [#10,#13]) then exit; + Result:=Result+LineEnding; +end; + function CompareLazFPDocFilenames(Data1, Data2: Pointer): integer; begin Result:=CompareFilenames(TLazFPDocFile(Data1).Filename, @@ -2401,6 +2409,7 @@ var OldCTNode: TCodeTreeNode; n: Integer; LastOwner: TObject; + s: String; procedure AddLinkToOwner(CurOwner: TObject); var @@ -2479,9 +2488,13 @@ begin //debugln(['TCodeHelpManager.GetHTMLHint2 fpdoc element found "',ElementName,'"']); AddLinkToOwner(AnOwner); - HTMLHint:=HTMLHint+GetFPDocNodeAsHTML(FPDocFile,ElementNode.FindNode(FPDocItemNames[fpdiShort])); - // todo elementlink - HTMLHint:=HTMLHint+GetFPDocNodeAsHTML(FPDocFile,ElementNode.FindNode(FPDocItemNames[fpdiDescription])); + s:=AppendLineEnding(GetFPDocNodeAsHTML(FPDocFile,ElementNode.FindNode(FPDocItemNames[fpdiShort]))); + s:=s+AppendLineEnding(GetFPDocNodeAsHTML(FPDocFile,ElementNode.FindNode(FPDocItemNames[fpdiDescription]))); + if s<>'' then begin + s:='
'+LineEnding + +'
Description
'+LineEnding+s; + HTMLHint:=HTMLHint+s; + end; HTMLHint:=HTMLHint+GetFPDocNodeAsHTML(FPDocFile,ElementNode.FindNode(FPDocItemNames[fpdiErrors])); // todo HTMLHint:=HTMLHint+GetFPDocNodeAsHTML(FPDocFile,ElementNode.FindNode(FPDocItemNames[fpdiSeeAlso])); HTMLHint:=HTMLHint+GetFPDocNodeAsHTML(FPDocFile,ElementNode.FindNode(FPDocItemNames[fpdiExample])); @@ -2816,8 +2829,8 @@ begin Result:=''; if AnOwner=nil then exit; if AnOwner is TLazPackage then - Result:='' - +'Package '+TLazPackage(AnOwner).Name+''; + Result:='Package ' + +TLazPackage(AnOwner).Name+''; end; procedure TCodeHelpManager.FreeDocs;