[fpc-pascal] Improve TStringList.Text setter?
Alexey Torgashin
support at uvviewsoft.com
Thu May 5 20:20:27 CEST 2022
(I posted to the forum, but it's better to post here.)
TStringList.Text setter does this
<pre>
Procedure TStrings.DoSetTextStr(const Value: string; DoClear :
Boolean);
...
if FLineBreak=sLineBreak then
begin
While GetNextLine (Value,S,P) do
Add(S)
end
else
While GetNextLineBreak (Value,S,P) do
Add(S);
finally
EndUpdate;
end;
end;
</pre>
here it calls GetNextLine which does SPECIAL handling of #10 and #13 and
#13#10 line breaks. If it does special handling of #10 and #13 and
#13#10 line breaks, why don't we check
if (FLineBreak=#10) or (FLineBreak=#13) or (FLineBreak=#13#10)
but we do simple
if FLineBreak=sLineBreak
Alexey
More information about the fpc-pascal
mailing list