Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2019-07

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

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Gabor Boros

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

Reply by email

Martin Frb
to Gabor Boros
Gabor Boros wrote 21 lines
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.

Reply by email