Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Carriage return

From Wikipedia, the free encyclopedia
Reset to the beginning of a line of text
icon
This articleneeds additional citations forverification. Please helpimprove this article byadding citations to reliable sources. Unsourced material may be challenged and removed.
Find sources: "Carriage return" – news ·newspapers ·books ·scholar ·JSTOR
(January 2008) (Learn how and when to remove this message)

Acarriage return, sometimes known as acartridge return and often shortened toCR,<CR> orreturn, is acontrol character or mechanism used to reset a device's position to the beginning of aline of text. It is closely associated with the line feed andnewline concepts, although it can be considered separately in its own right.

Typewriters

[edit]
Touchmaster Five with carriage return lever at left

Originally, the term "carriage return" referred to a mechanism or lever on atypewriter. For machines where the type element was fixed and the paper held in a movingcarriage, this lever was on the left attached to the moving carriage, and operated after typing a line of text to cause the carriage to return to the far right so the type element would be aligned to the left side of the paper. The lever would also usuallyfeed the paper to advance to the next line.

Many electric typewriters such asIBM Electric orUnderwood Electric made carriage return to be another key on the keyboard instead of a lever. The key was usually labeled "carriage return", "return", or "power return". With typewriters like theSelectric, where the type element moved when typing and the paper was held stationary, the key returned the type element to the far left and the term "carrier return" was sometimes used for this function.

To improve the keyboard for non-English-speakers, the symbol ↵ (U+21B5,HTML entity&crarr;) was introduced to communicate the combined carriage return and line feed action.

Computers

[edit]

Incomputing, the carriage return is one of thecontrol characters inASCII code,Unicode,EBCDIC, and many other codes. It commands aprinter, or other output system such as the display of asystem console, to move the position of thecursor to the first position on the same line. It was mostly used along withline feed (LF), a move to the next line, so that together they start a new line. Together, this sequence can be referred to asCRLF.[1]

The carriage return and line feed functions were split for practical reasons:

  • Carriage return by itself provided the ability to overprint the line with new text. This could be used to produce bold or accented characters, underscores, struck-out text, and some composite symbols.
  • Early mechanical printers were too slow to return the carriage in the time it took to process one character.[why?] Therefore, the time spent sending the line feed was not wasted (often several more characters had to be sent to ensure the carriage return had happened before sending a printing character). This is why the carriage return was always sent first.
  • It was then also possible to fit multiple line feed operations into the time taken for a single carriage return—for example for printing doublespaced text, headers/footers or title pages—to save print and transmission time without the need for additional circuitry or mechanical complexity to "filter out" spurious additional CR signals.

As early as 1901,Baudot code contained separate carriage return and line feed characters.

Many computer programs use the carriage return character, alone or with a line feed, to signal the end of a line of text, but other characters are also used for this function (seenewline); others use it only for aparagraph break (a "hard return"). Some standards which introduce their own representations for line and paragraph control (for exampleHTML) and many programming languages treat carriage return and line feed aswhitespace.

In both ASCII and Unicode, the carriage return is assignedcode point 13 (or 0D inhexadecimal); it may also be seen as control+M or^M. In character and string constants in theC programming language and in many other languages (including representations ofregular expressions[2][3]) influenced by C,\r denotes this character.[4]

See also

[edit]

References

[edit]
  1. ^"CRLF".MDN Web Docs.Archived from the original on 2024-03-04. Retrieved2024-03-04.
  2. ^"Regular expression syntax reference".JetBrains.Archived from the original on 2023-10-03. Retrieved2024-03-04.
  3. ^Jan Goyvaerts."Regular Expressions Quick Start".regular-expressions.info.Archived from the original on 2024-02-21. Retrieved2024-03-04.
  4. ^Eric S. Roberts (1995).The Art and Science of C.Addison-Wesley. p. 311.
Dead keys
Modifier keys
Lock keys
Navigation keys
Editing
Contextual
Misc.
Retrieved from "https://en.wikipedia.org/w/index.php?title=Carriage_return&oldid=1290311902"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2026 Movatter.jp