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 Fri, 2007-08-24 at 17:42 -0400, William Case wrote:
> I suppose there is a simple answer; there should be.  But I have been
> having difficulty even explaining what I am asking.  I usually get
> answers of the kind "Of course it executes the command.  You pushed
> RET" 

What happens when you press a key depends on the listening program.
Pressing "A" doesn't always type an A to the screen, likewise ENTER
doesn't always do the same thing (accepts the entry of data, finishes a
paragraph, inserts a blank line, etc.).

The terminal is an interface between keyboard and a program.  That
program might be the BASH interpreter, it might be a text editor.
Unless the interface snaffles up a keypress for itself (e.g. F11 for
full screen, in Gnome Terminal), the keypress is passed onto the end
program, for it do what it does with it, and perhaps returning some
acknowledging display to the interface.

That does demonstrate the problems of writing some programs - you may
have to design them for the limits of environments they're likely to be
used in (e.g. you couldn't expect always being able to notice the F11
key being pressed, in your program).

I've omitted at least one preceding part of the equation.  When you
press a key on the keyboard, e.g. "S", you're pressing key three down,
two across on a QWERTY keyboard.  It doesn't mean "S" to anything, at
this stage.  There's a keymap that associates keys in certain positions
with certain labels.  That means that all programs can use "S" as "S,"
in documentation and programming, no matter what keyboard you have, else
you'd have programs that used different hotkeys depending on your
keyboard (e.g. the same key is an "O" on a Dvorak keyboard).  I recall
Doten wishing that he could make his work differently, the other way
around, so that cut and paste, for instance, always used the same
buttons on the keyboard, no matter what letters they could represent.

-- 
[tim@bigblack ~]$ uname -ipr
2.6.22.1-41.fc7 i686 i386

Using FC 4, 5, 6 & 7, plus CentOS 5.  Today, it's FC7.

Don't send private replies to my address, the mailbox is ignored.
I read messages from the public lists.




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

  Powered by Linux