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?

Mailing lists / lazarus / 2013-05
8 messages · 5 people · –
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
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?
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
Fri, 31 May 2013 13:15:57 +0300 ???? ???????? Mattias Gaertner :
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
Fri, 31 May 2013 17:01:26 +0300 ???? ???????? Mattias Gaertner :
Thanks for reply!
Will wait for Martin...
Fri, 31 May 2013 13:15:57 +0300 ???? ???????? Mattias Gaertner : I know that, but I…
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
On Fri, 31 May 2013 13:18:45 +0300 Looking at the source code the LoadFromFile supports…
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).
?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>