mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 07:36:14 +02:00
IDE: code help: improved converting HTML to label caption
git-svn-id: trunk@13595 -
This commit is contained in:
parent
34f204e389
commit
ae4bac3436
@ -1217,7 +1217,7 @@ function TCodeHelpManager.GetHTMLHint(Code: TCodeBuffer; X, Y: integer;
|
|||||||
Complete: boolean; out BaseURL, HTMLHint: string; out CacheWasUsed: boolean
|
Complete: boolean; out BaseURL, HTMLHint: string; out CacheWasUsed: boolean
|
||||||
): TCodeHelpParseResult;
|
): TCodeHelpParseResult;
|
||||||
const
|
const
|
||||||
le = '<BR>'#13;
|
le = '<BR>'+LineEnding;
|
||||||
var
|
var
|
||||||
IsHTML: boolean;
|
IsHTML: boolean;
|
||||||
|
|
||||||
@ -1238,12 +1238,33 @@ var
|
|||||||
Result:=false;
|
Result:=false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TextToHTML(const s: string): string;
|
||||||
|
var
|
||||||
|
p: Integer;
|
||||||
|
EndPos: Integer;
|
||||||
|
begin
|
||||||
|
Result:=s;
|
||||||
|
// replace line breaks with <BR>
|
||||||
|
p:=1;
|
||||||
|
while (p<=length(Result)) do begin
|
||||||
|
if Result[p] in [#10,#13] then begin
|
||||||
|
EndPos:=p+1;
|
||||||
|
if (EndPos<=length(Result)) and (Result[EndPos] in [#10,#13]) then
|
||||||
|
inc(EndPos);
|
||||||
|
Result:=copy(Result,1,p-1)+le+copy(Result,EndPos,length(Result));
|
||||||
|
inc(p,length(le));
|
||||||
|
end else begin
|
||||||
|
inc(p);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure AddHTML(const s: string);
|
procedure AddHTML(const s: string);
|
||||||
begin
|
begin
|
||||||
if not IsHTML then begin
|
if not IsHTML then begin
|
||||||
IsHTML:=true;
|
IsHTML:=true;
|
||||||
if HTMLHint<>'' then
|
if HTMLHint<>'' then
|
||||||
HTMLHint:=HTMLHint+le+le;
|
HTMLHint:=TextToHTML(HTMLHint)+le+le;
|
||||||
HTMLHint:=HTMLHint+s;
|
HTMLHint:=HTMLHint+s;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user