Those line ending characters used to be control characters for teletypewriters (TTY). CR (carriage return) would tell the device to move the carriage (or print head or whatever) back to the beginning of the current line. Another LF (line feed) control character was necessary for moving the paper to the next line. It was not really a Windows choice or invention. Windows got it from MS-DOS to stay backwards-compatible and MS-DOS got it from CP/M, an OS from the 1970ies, and overall this is how TTYs worked. They needed CR and LF for doing the right thing.
The makers of Unix on the other hand decided that LF would be enough to tell a device driver to send the correct control sequence for moving to the beginning of the next line.
So in the olden days CRLF was a safer choice to control a teletypewriter.
AFAIK CRLF is still the full control sequence that is internally used by modern consoles and terminal emulators for moving the text cursor on the screen to the beginning of the next line. Hitting the Enter key produces just the CR control character. The terminal software automatically adds an LF to it
Git should force all committed files to use
lf
stop entertaining the idea windows choice has any merit.Yep, fully agree. I'm a Windows user and always set the eof to
lf
no matter what.Those line ending characters used to be control characters for teletypewriters (TTY).
CR
(carriage return) would tell the device to move the carriage (or print head or whatever) back to the beginning of the current line. AnotherLF
(line feed) control character was necessary for moving the paper to the next line. It was not really a Windows choice or invention. Windows got it from MS-DOS to stay backwards-compatible and MS-DOS got it from CP/M, an OS from the 1970ies, and overall this is how TTYs worked. They needed CR and LF for doing the right thing.The makers of Unix on the other hand decided that
LF
would be enough to tell a device driver to send the correct control sequence for moving to the beginning of the next line.So in the olden days
CRLF
was a safer choice to control a teletypewriter.AFAIK
CRLF
is still the full control sequence that is internally used by modern consoles and terminal emulators for moving the text cursor on the screen to the beginning of the next line. Hitting theEnter
key produces just theCR
control character. The terminal software automatically adds anLF
to itI realize this, and until recently both were needed for notepad to show new lines.
My point is we don't feed this to tty and when we do it is already worked out because recourse is no constrained.