cr, lf, and reading in terminals/vim

Bob Sneidar bobsneidar at iotecdigital.com
Thu Oct 31 10:34:39 EDT 2019


Interesting. This may be why when I copy code from the SE and paste it into an email I get double line spacing. 

Bob S


> On Oct 30, 2019, at 19:08 , Brian Milby via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> The reason for the difficulty is that internally LC uses LF as the line
> ending.  The cr, lf, and return constants all actually map to LF.  When you
> write a text file, LC will convert line endings to the native format.  So
> for Windows you get CRLF, Linux gets LF, and Mac gets CR.  I take issue
> with this because as of OS X the native line ending for the OS is actually
> now LF (although most of the stuff built in will handle either LF or CR).
> As a result, I always will generate my text files using binary mode,
> encoded as UTF8 on the Mac.  I will read everything using file to get the
> automatic conversion to LF though.  This does complicate making cross
> platform code that generates text files since you have to check the OS and
> either handle Windows or Mac differently.





More information about the use-livecode mailing list