Talk:Carriage return

From Wikipedia, the free encyclopedia
Jump to: navigation, search
WikiProject Computing (Rated Start-class, Mid-importance)
WikiProject icon This article is within the scope of WikiProject Computing, a collaborative effort to improve the coverage of computers, computing, and information technology on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
Start-Class article Start  This article has been rated as Start-Class on the project's quality scale.
 Mid  This article has been rated as Mid-importance on the project's importance scale.


I searched for the phrase "carrying return" on Google and got 140 hits, none of which seem related (mostly in the middle of phrases). Hephaestos 04:52 2 Jun 2003 (UTC)

I guess that usage has come to my mind in the same line that line feeding, carrying return. Anyway there is no such. -- Taku 04:54 2 Jun 2003 (UTC)


There is an inherent difference between enter and return on a computer, although many modern computer programs are written to take the two commands as the same, they are in fact individual and this article leads one to believe otherwise. —Preceding unsigned comment added by (talkcontribs)

There might be an inherent difference between them, but I think that depends entirely on your definition of 'inherent'. My keyboard, an IBM Model M, designed in the mid '80s to have a similar look and feel to a terminal, makes no distinction between the keys: they're both clearly labelled 'Enter'. Furthermore, the two keys, under normal keymaps, in Windows and Linux, generate the same keycode (0x0a) when you're capturing it from C. Even if you use getch() instead of getchar() - getch() returns KEY_ENTER for both.
Going down a level, to hardware: the only real difference is that the main enter key makes the keyboard port read 28, whereas the keypad enter key does the extended character signal before reading 28. This distinction is, much of the time, lost before the key stroke gets to userland programs. Thus, it's not correct to say "many modern computer programs are written to take the two commands as the same": unless you're implementing your own keyboard controller, you don't have a choice to make the two work differently.
Well, that's all I could find out anyway. I'd be interested if someone has information to the contrary. --Dom 10:52, 30 September 2006 (UTC)
In my opinion enter and return are names for the keys (not e.g. names for the key codes). I think being able to refer to either key separately is important, as the keys are treated separately in some cases. I have seen some modern keyboards confusingly combine the keylabels, but never old ones. Return is something inherited from a type writer, while enter is an additional computer keyboard key. To be honest I have to admit that I'm short on hard facts. I rely on my own experience on the issue. --Easyas12c 21:47, 30 September 2006 (UTC)
Agreed though i do know of one app that treats them seperately (a well known level editing tool written by a guy called ken), they key on the main keyboard is nearly always reffered to as enter with the key on the numpad reffered to as keypadent or similar if there is a need to differentiate.
RE: old keyboard labels. See, that's what I'm saying: the keyboard I'm using (the model M) is about the oldest you're likely to find these days and one of the most durable pieces of computer hardware, ever. And, yes, it has the labels, as you would say 'mixed up'. The only keyboard I can find that has 'return' labelled is a (relatively recent) mac keyboard. --Dom 01:39, 1 October 2006 (UTC)
Return is a name for the key, not necessarily a label. Usually it is marked with the arrow symbol, right? Yet, my current keyboard ( Happy Hacking Keyboard Lite ) has the key labelled "Return" by text and is missing the enter key completely. I feel that we'll probably need a new Enter v.s. Return Controversy -article. Could you post a picture showing that old mixed up one? --Easyas12c 09:16, 1 October 2006 (UTC)
We probably don't need a page: hard facts on the issue are pretty hard to come by anyway. One other thing to think about is that, even though the center key is marked with what you might call a carriage return symbol, the code it generates is a line feed: so, I'd ask, what did the key do on a standard typewriter? Did this function vary between manual typewriters (could conceivably have been line-feed, unlikely to be carriage return) and electric typewriters (could have been either or both)? Anyway, as a form of compromise I'm sure we can agree that while there isn't an inherent difference between enter and return on a computer, there is a nominal one. --Dom 11:48, 1 October 2006 (UTC)
Without extraordinary evidence to the contrary i find even claiming that there is a nominal difference a stretch, another poster has already mention that he has an IBM model M (aka one of the best known keyboards and made by the original creator of the PC) which is clearly labeled enter on both and that the only difference in the keycodes they send is that one is marked as extended. Use of the name "return" with reference to pc keyboards is almost unheared of. Plugwash 16:57, 1 October 2006 (UTC)
I'm not following. We can easily agree that an old IBM keyboard has a key (or several keys) labelled enter. How do we know that one of these keys is in fact return (in disguise)? I think we'd first have to agree on the context and specify it with care. Are we talking about key labels or possibly something else? Note that almost every key can be configured to do almost anything. So the key name can't depend on use. Keyboard shapes and keycodes vary, so we can't rely on them either. --Easyas12c 07:01, 2 October 2006 (UTC)

A Recap of the Situation[edit]

There are two keys on modern 101+ key keyboards that are described as 'Enter' or 'Return' keys. One side of the current debate is that the left of these is properly named the 'Return' key, and the right the 'Enter' key. The other side is that the two are not distinguishable (and, as a side-effect, each may be called 'Enter'). Curiously, up until a few revisions ago, the exact opposite view to what is being contended above was on the page, as shown in this change: [1]. The fact that this went unnoticed since January this year, before being changed to the exact opposite, may speak to the lack of a generally accepted standard in this matter.

You got it wrong. The change did not change the order. The new image had the colors swapped. The explanations were swapped along. So only the colouring was really swapped. This is an article about return, so return ought to be green. --Easyas12c 14:50, 3 October 2006 (UTC)
Right, sorry, I didn't notice the image changed at the same time. --Dom 00:32, 4 October 2006 (UTC)

There's a picture of a 1986 IBM Model M at Image:ModelM.jpg. To clarify, at the lowest level: both keys are physically marked 'Enter'. As far as labelling goes, I can't recall the last time I saw a keyboard with left key labelled as 'Return', although I'm told such keyboards exist. Macintosh keyboards, particularly older ones(?), do label the left-enter 'Return'. A great many keyboards do not label the left key at all, and just have a arrow representing a line feed and carriage return.

Happy Hacking -keyboards [2] [3] have a key labeled Return. --Easyas12c 14:58, 3 October 2006 (UTC)

One level up, at the hardware interface level: the left key generates an interrupt of 28, the right key generates an extended interrupt then an interrupt of 28. I don't have any Macintosh hardware around to test if this is true of Mac keyboards, but, as some keyboards work for both PC and Mac, I'd imagine it wouldn't be any different at this level.

It gets a little more complex one level up, at the OS level. In Windows, as far as I can tell, there's no way to differentiate between the two keys at the software level. What this means is you can't, as far as I can tell, configure your key mappings to assign a different code to each key. The situation is the same in Linux, although there you could possibly modify the source of the keyboard controller (that is, change the operating system) to recognise extended-28 as a different key. Until you do this, to all software, the keys don't just look the same: they _are_ the same. To get a feel for this (non-)distinction, the left and right shift, alt and control keys are distinguished between at this level; enter is not. Under MacOS, I'm aware that there is a difference in some software, so there is likely a difference recognised by the OS: I'd appreciate someone with Mac hardware testing this.

I'm running Ubuntu which has Linux. xkeycaps lights up enter key symbol and only enter key symbol when I press enter. When I press return it lights up return key symbol and only return key symbol. I also recall some DOS game key setup which recognised both enter and return separately. --Easyas12c 15:14, 3 October 2006 (UTC)
I was also doing my testing in Ubuntu. The difference in our results is because of X11, which does all of its own keyboard stuff. So, to clarify, the situation is the same as Windows for the Linux command line. In the GUI, it's possibly different. --Dom 00:32, 4 October 2006 (UTC)

Finally we have the software level. This level depends on operating system. Under Windows, programs written in C (and compiled on Windows) show no difference between the keys: both generate 0x0a. Under Linux, programs written in C again can't tell the difference.

Unless they make use of the X11 libraries(?) --Dom 00:32, 4 October 2006 (UTC)

Macintosh programs could concieveably detect a difference between the keys, and there's some evidence of programs doing this (a Turtle Logo program possibly).

From what I can tell, and not to put words in others' mouths, Easyas12c seems to be advocating us sticking to the physical level: so, we focus on what each key is called, not what each key does. --Dom 13:14, 3 October 2006 (UTC)

Which is something I don't particularly agree with. I think the primary difference between the keys should be in what they do; this is in the same way that we don't specify which of the two shift keys we are talking about, except where the difference matters. Under the default bindings on most operating systems (including Linux, because of the way X11 is initially set up), there's no substantive difference between the keys, and I think that's what we should be considering. The labelling is a nominative difference. Perhaps we can work on edits we both agree with in a new subsection? --Dom 00:32, 4 October 2006 (UTC)
I'm a professional computer programmer. I can assure you that the key codes which the physical keyboard sends to the computer CAN be different, even if the operating system ignores these differences.
On my hp Compaq running Windows XP, there's no difference (in Java) between the two Enter keys. But there is still a difference between say 8 under the asterisk and 8 on the keypad.
I'd say if people remember using systems other than Windows and getting different functionality, depending on which Enter key they hit, we should believe them. Windows is not the pond, just the biggest frog in it. --Uncle Ed 17:34, 16 January 2007 (UTC)
I'm also a professional computer programmer. I can assure you that the key codes which the physical keyboard sends to the computer are the same, except that one (the keypad) sends an extended interrupt before the key code (it'd be that interrupt which is ignored by the OS).
I do believe people when they say they get different functionality with the two keys - I've experienced it myself in one program. And I don't use Windows, so I don't see why your pond/frog analogy is relevant at all. --Dom 13:18, 23 January 2007 (UTC)

Various facts that I know, as there seems to be mis-information above (I will use "Return" for the main key and "Enter" for the key in the lower-right of the numeric keypad, but this is not necessarily correct):

  • All PC keyboards I can find (dating back to the IBM-XT and up to a recent Microsoft Natural keyboard) say "<-' Enter" on the return key and just "Enter" on the enter key (so there is a slight difference in that the arrow is only on return).
  • All OSX macintoshes including an 8 year old one say "Return" on the return key and "Enter" on the enter key. I don't have a pre-OSX mac to check, however.
  • The influential DEC VT100 and VT52 terminals had no enter key, the keypad instead had a large "+" in the lower-right.
  • The keyboard hardware definitely produces a different signal (ie scan code) for the keys. So the operating system can tell them apart.
  • Xorg X11 translates these to the X11 keysyms "Return" and "KP_Enter", so an X11 program can tell these apart.
  • Windows returns the keysym XK_RETURN for both of them, but sets the "extended" bit for the enter key. So in most uses programs can tell them apart. However it appears the function GetKeyState() cannot distinguish them, GetKeyState(XK_RETURN) returns true if either one is held down.
  • There have been actual programs that have treated these keys differently: the main one I am familiar with is Mathmatica where you could type a multi-line formula in with return between each line, but then execute it by typing Enter. I think such use has dropped out of fashion due to the lack of an enter key on many machines.

Spitzak (talk) 19:09, 29 January 2011 (UTC)

Problem With This Article[edit]

This is linked to a redirect from Control-M??? The return carriage does not have anything to do with the Unix Scheduler Control-M; they are two different things. I don't understand the reference here. —Preceding unsigned comment added by (talkcontribs)

I'm not sure what the 'Control-M Unix Scheduler' you're talking about is, but I can tell you why control-m redirects to this page. Under pretty much any command line interface you'd care to name (including bash, Windows' cmd.exe, etc.), holding down control and pressing the m key generates a carriage return, just as if you'd hit the enter/return key. --Dom 04:14, 22 December 2006 (UTC)

Toward an understanding[edit]

I think that right now, what this discussion needs is a set of principles that tell us how to determine what a key is. Until we've got that, discussion will keep going round and round. So, here are two questions I'd love to have answered.

What can we use to determine if one enter/return key varies from the other enter/return key?

  • We can't use key labelling. Easyas12c points out that, even if we did look at labelling, "how do we know that one of these [enter] keys is in fact return (in disguise)?"
  • We can't use key function. Easyas12c points out that "almost every key can be configured to do almost anything. So the key name can't depend on use."
  • We can't use the physical codes returned by the hardware. Easyas12c points out that "keycodes vary, so we can't rely on them either." (I'm not sure they do vary, but OK)

If they do turn out different, how would we figure out which is which?

  • Again we apparently can't use key labelling, function or elements of the hardware.

I might be wrong, but they look like they're pretty unanswerable under the criteria. The obvious thing to do is to re-evaluate those criteria. In which case, the only important question becomes:

What makes a key, a key: name, function or something else?

In other words, should we be concerned with the nominal issue or the substantive one? I'd love to hear some thoughts. Once we've got that worked out we can easily determine the situation. --Dom 13:35, 23 January 2007 (UTC)

Which Came First[edit]

Originaly [...] the term for the control character [...] on a teletypewriter [...] Later it was used [...] on a typewriter

What was the typewriter mechanism called before this? Or was it just not talked about? 10:31, 28 October 2007 (UTC)

The mechanism on a standard manual typewriter is usually called a carriage return lever. Milkunderwood (talk) 09:58, 15 April 2010 (UTC)
I took the liberty of switching these two around. I'm inclined to believe that the original was an old vandalism that went unnoticed, because the teleprinter term coming before typewriters which actually use a physical carriage makes absolutely no sense. The note there about CLRF makes no sense either, until (correctly, in my opinion) looked at in conjunction with the sentence about teleprinters, NOT typewriters. But, ah, if someone believes this thinking to be mistaken and can explain how the deuce it makes sense to put it the other way around, please do so. ʎəɹSquared 21:09, 31 July 2010 (UTC)

Use as end-of-line[edit]

With regards to carriage return denoting end of line, is not CRLF in all systems, but it is common for Windows. It should be noted that old Mac and most Unix (old and new) systems use LF alone, and the newer Macs CR alone. In most devices where space is limited, i.e. handhelds, only one character is used to save space. Windows doesn't convert correctly from just one out of the CRLF combo to CRLF, you need a specialised program.