On Mon, Jul 31, 2006 at 01:19:58AM +0800, Dan Jacobson wrote: > On my Thinkpad, in xterm, pressing home and end give: > $ cat -v > ^[[H > ^[[F > $ infocmp |sed 2!d > xterm|X11 terminal emulator, > $ infocmp -1|grep '\\E\[[FH]' > clear=\E[H\E[2J, > home=\E[H, > $ infocmp -1 -C|grep '\\E\[[FH]' > :cl=\E[H\E[2J:\ > :ho=\E[H:\
The terminfo's written to assume that the application sends smkx (which
puts the keypads into application mode). That's standard (sending smkx),
though some terminfo's were designed to make the bash users happy (mainly
the "linux" description). You can see the effect of changing the modes
easily in xterm using the "VT Options" menu.
> Well for some reason lynx and w3m know what end sends even though it
> isn't listed above. Home OK too.
>
> In rxvt,
> $ cat -v
> ^[[7~
> ^[[8~
> $ infocmp|sed 2!d
> rxvt-unicode|rxvt-unicode terminal (X Window System),
> $ infocmp -1 |grep '\\E\[[78]~'
> kend=\E[8~,
> khome=\E[7~,
> $ infocmp -1 -C|grep '\\E\[[78]~'
> warning: rxvt-unicode entry is 1134 bytes long
> :kh=\E[7~:\
>
> Here we have different names, and termcap lesser entries, and all I
> know is lynx still knows what to do but w3m doesn't respond to home
> and end.
I seem to recall that rxvt's terminfo is (like "linux" ;-), written for
bash-users, and assumes the terminal is started in application mode.
Checking, I see smkx differs between the two:
smkx: '\E[?1h\E=', '\E='.
xterm is on the left; you'll note that xterm uses two escape (\E) sequences
while rxvt uses one. The \E[?1h sets the cursor-keys into application
mode. I know offhand that (because of the way X defines the keycodes),
the home/end keys are classified as cursor keys - for xterm. I'm not
sure about rxvt since it bends the rules differently. Since rxvt isn't
setting that mode explicitly, and because its arrow keys are specified
in application mode, it's possible that some application reset it to
the normal mode. (That might affect the home/end keys - I'm not sure
w/o testing it).
Oddly a quick check of rxvt's rs1/rs2 strings (used in "reset") seems to
show it resetting the terminal's cursor keys into normal mode. But running
"reset" and then using cat -v still shows ^[[A (normal mode), which is
consistent. If I use TERM=xterm, then it would change to ^[OA (application
mode). But a quick check doesn't show home/end changing. It's still
^[[7~ and ^[[8~ respectively.
> The Thinkpad r50e does not have a keypad, and I didn't hit shift, not
> tinker in ~/.Xresources.
>
> On my desktop 2.6.16-1-k7, all the above is the same. And there is an
> additional numerical keypad at the right, where there are additional
> home and end keys, and they send:
> ^[Ow ^[Oq in rxvt (lynx uses them, w3m doesn't), and again ^[[H ^[[F in xterm.
lynx has some hardcoded fallbacks for vt320 escape sequences that might
be catching this case. In the default keyboard configuration, xterm
sends the keys as labeled, e.g., home/end.
> In /etc/X11/xorg.conf on both machines I do
> Option "XkbRules" "xorg"
> Option "XkbModel" "pc104"
> Option "XkbLayout" "us"
> but apparently that is not the problem.
I don't think so either (I've done most of my testing with pc104/us).
--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net
pgpjV7BlYEFRF.pgp
Description: PGP signature

