Line feed

from Wikipedia, the free encyclopedia
<LF>

The line feed ( English line feed , short LF , German also obsolete ZL ) is the instruction on output devices for text to move to the next line .

The line feed must be distinguished from the carriage return (CR) character and the line break in the typography .

Typewriters

Line feed setting 1, 2, 3
Underwood No. 4/5, around 1920

In the original sense, line feed is the rotation of the cylinder on a typewriter. The car is at the start of a new line with the line shift lever manually pushed back (carriage return) . The paper is also transported further by the line feed set on the carriage beforehand . To do this, the line shift lever actuates a ratchet lever that engages a gear on the roller axle and continues to rotate it. For the line feed, there are various detent positions for the line spacing and, in some cases, buttons that prevent the line feed or reverse it to get to a line above.

Teletype

Line feed (ZL) and carriage return (WR)
key Siemens T37h teleprinter, 1950s

For teleprinters you needed a control character that basically does exactly the same thing, namely moving to the next line. Historically, two control characters were introduced for "new line", first a carriage return (WR, English carriage return CR) and then the jump to the next line (ZL, line feed LF). This is due to the fact that a simple line feed in the mechanical sense only advances the roller, i.e. moves the writing position to the next line. Only the carriage return brings it to the very beginning of this line. Because of the large mass to be moved, a carriage return took longer than the printing of a character or a line feed. At full writing speed, especially from the punched tape, the writing head was still moving horizontally while the second character was being processed for line feed. The next text character was printed (with the best mechanical setting of the carriage return) exactly at the beginning of the new line. The end of a line with the double character CR LFwas therefore inevitable.

computer

With the advent of electronic data processing and the associated peripheral devices such as printer and screen , teleprinter technology was used to display line breaks and control the cursor .

The different operating systems, however, proceeded inconsistently. For some, the interpretation of the typographic paragraph mark ( Pilcrow ) through the character string CR LF (corresponds to ASCII 0x0D 0x0A ) was used unchanged - for example with CP / M , DOS and Windows (and thus also in text editors such as Notepad ) - with others, namely Unix and Unix-like ones Systems , this was shortened to the single character LF Line Feed (the line feed discussed here), while under classic Mac OS it was shortened to the single character CR Carriage Return (the carriage return ). And still other systems know their own symbol NLor NEL(English for New Line or Next Line ) or a symbol EOL(English for End of Line ). For this reason, the exchange of text files between different operating systems is considerably more difficult. Many programs ( e.g. browsers ) therefore accept each of these control characters as a line feed, even if this is not technically correct. In other programs differentiate between CRand LFthe paragraph end and the hard line break or the column break.

Character encoding and input

A line feed character is necessary in order to be able to output texts with breaks and paragraphs accordingly. For this reason, such a control character was provided in practically all character sets .

The common abbreviation is LF

  • in the ASCII character set, the most widespread and most used character set worldwide, e.g. B. the character hexadecimal 0A or decimal 10 is provided for this.
  • in the EBCDIC code it is the character hexadecimal 25or decimal 37. (All EBCDIC codes also have NL New Line on hex. 15, Dec. 21, And today (2007) on 06RNL Required New Line , "required new line" for conditional coding within the automatic line break .)

The line feed can be entered:

The direct original command "Line feed" is achieved by cursor control using the arrow keys with the text mark down , whereby the reaction of the cursor is inconsistent: In some editors (especially those close to the system) the mark is actually consistently moved down, in others the cursor jumps to shorter lines at the end of the line, whereby the old position is partially saved and the cursor is set back to the original position on a subsequent longer line.

Individual evidence

  1. Dirk Louis: C, C +: the complete programming knowledge for study and job . Pearson, 2010, pp. 920 ( full text in Google Book Search).