Re: OT What does RET (Enter) do and how does it do it ??

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 2007-08-25 at 10:00 -0700, Les wrote:
> > [snip]
> > 
> > > Well, it's simple.  The intent of text editors, word processors
> and the
> > > like is that whatever you type in gets saved in the file.  In
> *nix-ish
> > > operating systems (Linux, Unix, MacOS, etc.), the RETURN or ENTER
> key is
> > > denoted by a single character in the file.  We call this the
> "newline"
> > > character, which is the hexadecimal value 0x0a.  In ASCII
> parlance,
> > > that's the "LF" or "linefeed" character.  The LF character can
> also
> > > be entered by holding down the "CTRL" key and pressing "j" (also
> > > sometimes called "control-J").
> > > 
> > > In Windows-type stuff (DOS, Windows, CP/M, etc.), the ENTER key is
> > > denoted by a two character sequence, the hex value 0x0d (ASCII
> "CR" or
> > > "carriage return"), followed by the hex value 0x0a (ASCII "LF" or
> > > "linefeed" again).  We call this sequence the "CRLF" sequence.
> Note
> > > that the "CR" character can also be entered by holding down the
> "CTRL"
> > > key and pressing "m", which is why it's sometimes called
> "control-M".
> > > 
> > > (ADDITIONAL INFO: The hex value of "m" is "0x4d" and that of "j"
> is
> > > 0x4a.  Holding down the CTRL key inhibits the generation of bit 6
> or
> > > the value of 0x40, so CTRL-M generates 0x0d instead of 0x4d.
> Easy.)
> > > 
> > > So much for text editors, word processors and the like.  Now, when
> > > you're at a command prompt or other program requesting input
> (remember
> > > that the command prompt is the shell program asking for input),
> the
> > > RETURN (or ENTER) key signals the end of user input and the
> program then
> > > processes that according to whatever the program is supposed to
> do.
> > > 
> > > Does that clarify things?
> > > 
> > To re-summarize, the meaning of RET is established by the program
> being
> > used.  The program can create it's own meaning for RET; or use a
> > standardized meaning according to what has been bound to the keymap
> the
> > program is using, or redefine the keymap it uses to bind one or
> another
> > meaning to a key press or event. 

It seems to me that there is a point that is being missed. What you type
on the keyboard is just a continuous stream of characters. A line feed
which you get in Linux when you hit return is just a character like any
other. When you hit a g the letter g is printed. When  a text editor is
analyzes the line feed it knows to go to the next line. When the shell
sees the line feed it knows it is to treat everything on the line up to
the line feed as a command. No magic is involved and it is really very
simple.
--
=======================================================================
Il brilgue: les t^oves libricilleux Se gyrent et frillant dans le
guave, Enm^im'es sont les gougebosquex, Et le m^omerade horgrave. Es
brilig war. Die schlichte Toven Wirrten und wimmelten in Waben; Und
aller-mumsige Burggoven Dir mohmen Rath ausgraben. -- Lewis Carrol,
"Through the Looking Glass"
=======================================================================
Aaron Konstam telephone: (210) 656-0355 e-mail: akonstam@xxxxxxxxxxxxx


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux