Hi All,

I've been struggling with something I would like to implement.

A user asked me if it would be possible to preserve Windows EOL (CRLF)
for files originating from Windows, but opened and modified in gbEdit
(Gambas written texteditor).

What happens now is that, if I add a few new lines to a windows
originated text file, the new lines will be saved with a linux EOL (LF).
The lines already having the Windows EOL (CRLF) are preserved.

gbEdit makes use of a Editor control. Saving the contents is now done
with a simple:

File.Save($sPathFileLoaded, editMain.Text)

Where $sPathFileLoaded is the full path and name of the file
AND
editMain.Text is the name of the Editor control holding the content.

Upon opening a file gbEdit determines the EOL and returns either:
CRLF for Windows EOL
LF for Unix EOL
CR for Classic Apple Mac EOL

So I have all in place to determine when Windows EOL needs to be used
upon saving.

What I need is that new lines added, to a file already using Windows
EOL, have to be saved with Windows EOL as well.

I imagine I could save the file as a stream, making sure the proper EOL
is added, but was wondering if there might be any easier way in Gambas
that can do the job (as somehow that often turns out to be the case).

Any suggestions?


-- 
Kind regards,

Willy (aka gbWilly)

http://gambasshowcase.org/
http://howtogambas.org
http://gambos.org





------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to