On Thu, 5 May 2022, Alexey Torgashin via fpc-pascal wrote:

(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)

This would change the behaviour.

Now the special treatment is only done when FLinebreak exactly matches
sLineBreak.

Michael.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to