I come across another problem, using the <pre>-tag instead of the span and TextToHTML:
my comments in the Hint looked like this:
Line 1
Line 2
Line 3
This is because in TextToHTML the <br> is inserted before the CrLf
With:
function TCodeHelpManager.TextToHTML(Txt: string): string;
var
p,po: Integer; // <-- New Variable here
begin
Result:=Txt;
p:=length(Result);
while p>0 do
begin
case Result[p] of
' ',#255: Result:=copy(Result,1,p-1)+' '+copy(Result,p+1,length(Result));
'<': Result:=copy(Result,1,p-1)+'<'+copy(Result,p+1,length(Result));
'>': Result:=copy(Result,1,p-1)+'>'+copy(Result,p+1,length(Result));
'&': Result:=copy(Result,1,p-1)+'&'+copy(Result,p+1,length(Result));
#10,#13:
begin
po:=p; // <-- Saving the old Position
if (p>1) and (Result[p-1] in [#10,#13]) and (Result[p-1]<>Result[p]) then
dec(p);
Result:=copy(Result,1,p-1)+'<br>'+copy(Result,po+1,length(Result)); // <-- using the 'Old Position'
end;
end;
dec(p);
end;
end;
Removing the CrLf it works for me.
Maybe a parameter preformated:boolean := false; is the more flexible solution.