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

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Free Pascal - Lazarus mailing list
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.

Gabor
--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

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

Free Pascal - Lazarus mailing list
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.
--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus