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

Re: Xterm and function keys



Andy Spiegl <debian-user.Andy@spiegl.de> writes:
>In an xterm the function keys produce the following:
> F1 -> ^[OP
> F2 -> ^[OQ
> F3 -> ^[OR
> F4 -> ^[OS
> F5 -> ^[[15~
> F6 -> ^[[16~
>...
>
>On a different system (I tried SuSE) they produce:
> F1 -> ^[[11~
> F2 -> ^[[12~
> F3 -> ^[[13~
> F4 -> ^[[14~
> F5 -> ^[[15~
> F6 -> ^[[16~
>...
>which seems more correct.  I also get this behaviour on my Debian (potato)
>box when I use rxvt or konsole.

On my system, the xterm bindings are ^[OP, ^[OQ, ^[OR, ^[OS, ^[[15~,
^[[17~, ^[[18~, ... (^[[16~ is missing for some reason.) rxvt creates
^[11~ and so forth. On the linux console, they are ^[[[A, ^[[[B,
^[[[C, ^[[[D, ^[[[E, ^[[17~, ^[[18~, etc.

But the ^[OP etc. are "normal" for xterms. There is really nothing
that says that something is "correct" and something else is not; as
long as the keys agree with what your terminal type specifies,
everything should work. Different terminals are just, well, different.
The differences seem quite arbitrary, but they probably have
historical reasons behind them...

All of the xterm, xterm-debian and xterm-xfree86 terminal types are
specified so that F1=^[OP. (You can see this by executing "infocmp
xterm-debian" and looking for "kf1=\EOP" in the output (^[ = \E = the
ESC character). The terminal type is selected with the TERM
environment variable, which xterm and the other programs should
automatically set to a correct value.)

So, basically, please don't care about it. :) If some keys don't work
somewhere, check your TERM environment variable and/or complain (but
please look at /usr/doc/xterm/README.Debian first, though the problems
it talks about concern mostly the Backspace and Delete keys). If you
write your own programs, don't depend on particular key bindings; get
them from terminfo instead. Otherwise, don't worry about it...

-- 
-=- Rjs -=- rjs@lloke.dna.fi


Reply to: