Sign in Join

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

Mailing lists / lazarus / 2013-05

SynEdit changes line ending

8 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

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

Misha Padalka

Hi!

A little problem with SynEdit.
If I assign text to SynEdit with SynEdit.Text property, it does not honor text line ending, and always converts it to system line-ending.

How to make it does not change text line-ending style?

?? ???????????? ??????? ??????????? ????? Opera: http://www.opera.com/mail/

Reply by email

Mattias Gaertner
to Misha Padalka
Show quoted text 8 lines
Misha Padalka hat am 31. Mai 2013 um 12:01 geschrieben: Hi! A little problem with SynEdit. If I assign text to SynEdit with SynEdit.Text property, it does not honor text line ending, and always converts it to system line-ending.

Synedit only supports one line ending type for the whole text, not per line.

How to make it does not change text line-ending style?

Probably Martin can answer that when he comes back from vacation next week.

Mattias

Reply by email

Misha Padalka
to Mattias Gaertner

Fri, 31 May 2013 13:15:57 +0300 ???? ???????? Mattias Gaertner :

Show quoted text 14 lines
> Misha Padalka hat am 31. Mai 2013 um 12:01 > geschrieben: > > > Hi! > > A little problem with SynEdit. > If I assign text to SynEdit with SynEdit.Text property, it does not > honor > text line ending, and always converts it to system line-ending. Synedit only supports one line ending type for the whole text, not per line.

I know that, but I assign whole text, not its part. So I think it should save it's line ending style.

?? ???????????? ??????? ??????????? ????? Opera: http://www.opera.com/mail/

Reply by email

Mattias Gaertner
to Misha Padalka
Show quoted text 8 lines
Fri, 31 May 2013 13:15:57 +0300 ???? ???????? Mattias Gaertner : [...] > Synedit only supports one line ending type for the whole text, not per > line. I know that, but I assign whole text, not its part. So I think it should save it's line ending style.

Looking at the source code the LoadFromFile supports that. I don't see it for SetText. Probable Martin knows more.

Mattias

Reply by email

Misha Padalka
to Mattias Gaertner

Fri, 31 May 2013 17:01:26 +0300 ???? ???????? Mattias Gaertner :

Show quoted text 14 lines
On Fri, 31 May 2013 13:18:45 +0300 "Misha Padalka" wrote: > Fri, 31 May 2013 13:15:57 +0300 ???? ???????? Mattias Gaertner > : > [...] > > Synedit only supports one line ending type for the whole text, not per > > line. > > I know that, but I assign whole text, not its part. So I think it should > save it's line ending style. Looking at the source code the LoadFromFile supports that. I don't see it for SetText. Probable Martin knows more.

Thanks for reply!
Will wait for Martin...

?? ???????????? ??????? ??????????? ????? Opera: http://www.opera.com/mail/

Reply by email

Hans-Peter Diettrich
to Misha Padalka: Fri, 31 May 2013 13:15:57 +0300 ???? ???????? Mattias Gaertner : I know that, but I…
Show quoted text 5 lines
> Synedit only supports one line ending type for the whole text, not per > line. I know that, but I assign whole text, not its part. So I think it should save it's line ending style.

Dunno if this applies also to SynEdit:

Most edit controls break the Text into lines (TStringList), so that all line endings are lost. Line endings (of one type) are only added again when the Text property is read later, or stored in an file.

DoDi

Reply by email

Martin
to Mattias Gaertner: On Fri, 31 May 2013 13:18:45 +0300 Looking at the source code the LoadFromFile supports…
Mattias Gaertner wrote 13 lines
On Fri, 31 May 2013 13:18:45 +0300 "Misha Padalka" wrote: > Fri, 31 May 2013 13:15:57 +0300 ???? ???????? Mattias Gaertner > : > [...] >> Synedit only supports one line ending type for the whole text, not per >> line. > I know that, but I assign whole text, not its part. So I think it should > save it's line ending style. Looking at the source code the LoadFromFile supports that. I don't see it for SetText. Probable Martin knows more.

Yes, it is only supported by LoadFromFile/SaveToFile (and only because it was there since probably before we forked).

I would not be in favour of detecting the style when setting text. That will lead to a lot of confusion. There may be mixed style, or other operations later can have other style. It is also unescesarry work, for something rarely ever needed (unless stored for each line, but that is a huge feature).

It would *probably* not be hard to add it to "GetText" (property Text) (with a property, that the user can set, to the desired line-ending).

But imho that just gets the problem started. Once it works for GetText, users will (rightfully) expect it for other methods to: SynEdit.SelText / SynEdit.TextBetweenPoints / CopyToClipboard .... And that will be a lot more work (still possible).

Reply by email

Zaher Dirkey
to Martin
Martin wrote 6 lines
I would not be in favour of detecting the style when setting text. That will lead to a lot of confusion. There may be mixed style, or other operations later can have other style. It is also unescesarry work, for something rarely ever needed (unless stored for each line, but that is a huge feature).

?I agree, there is a lot of file types not just line ending, like encoding, BOM, ?etc...

Best Regards
Zaher Dirkey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130608/3f5956e6/attachment.html>

Reply by email