[Lazarus] SynEdit - Why a new line added at the end of the text?

Martin Frb lazarus at mfriebe.de
Mon Jul 22 20:32:33 CEST 2019


On 22/07/2019 20:18, Gabor Boros via lazarus wrote:
> Hi All,
>
>
> procedure TForm1.Button1Click(Sender: TObject);
> var
>   SE:TSynEdit;
>
> begin
>   SE:=TSynEdit.Create(Self);
>   SE.Text:='abc';
>   ShowMessage('*'+SE.Text+'*');
>
>
> For me the above code show the next message:
>
> *abc
> *
>
> Any idea why a new line added? With TMemo the result: *abc*
>
> I use fixes_2_0 with FPC fixes_3_2 on Windows 64bit.

SynEdit stores the text as one string per line. And it does not 
currently store the line-endings. When you retrieve the entire text as 
one string, each line is ended by a line-ending.

So if you have one line in there, then that line gets a line ending when 
you read it back.


More information about the lazarus mailing list