logoalt Hacker News

SoftTalkertoday at 2:24 AM1 replyview on HN

And of course ASCII separates them, with LF (linefeed, sometimes called newline) and CR (carriage return, or just return) being two separate characters. Windows (and probably some other) text file conventions used CR+LF to end a line, while unix conventions used just LF (hence the alternate name of "newline").


Replies

chowellstoday at 2:33 AM

In line printers, a line feed moves the paper forward one line. A carriage return moves the print head back to the start of a line. You can do interesting things by making them separate commands, like bold text (overstrike) or underlining, so they were independent commands for talking to a line printer.

ASCII standardized on a character set containing control codes for line printers, so it included CR and LF separately. It's a bit weird that some terminals changed the semantics of those control codes, but I guess things never stay static in time.

show 1 reply