No, \r
(carriage return, or CR
) is only correct for old Mac OS, so up to release 9.
OS X is a complete rewrite, and now a UNIX-based OS. It uses \n
(line feed, or LF
).
From Wikipedia on the subject of Newline:
LF
: Multics, Unix and Unix-like systems (GNU/Linux, Mac OS X, FreeBSD, AIX, Xenix, etc.), BeOS, Amiga, RISC OS and others.[...]
CR
: Commodore 8-bit machines, Acorn BBC, ZX Spectrum, TRS-80, Apple II family, Mac OS up to version 9 and OS-9
See Historical reason behind different line ending at different platforms for some history behind this.
Instead, it's Scintilla that is in the wrong here. The Line endings documenation suggests it defaults to \r
when on Mac:
Scintilla can interpret any of the Macintosh (
\r
), Unix (\n
) and Windows (\r\n
) line ends.
You can use the SCI_SETEOLMODE()
function to alter that behaviour, whatever the Python binding equivalent is should be passed the os.linesep
value to make Scintilla use the correct line separator for your platform.
I see that there is a QsciScintilla.setEolMode()
method and a EOLMode
enum to accomplish that; I guess you'll need to map python line ending variants to the enum and pass the right enum value to the .setEolMode()
method.