If you do a "cat -vtu" in an xterm and hit the arrow keys on a PC
keyboard, under Linux, you'll see that the down key generates
ESC [ D and the left generates ESC [ B (the others generate ... A and
C).
Now if you do an "infocmp xterm" you'll observe that terminfo has a
definition for up and right ("cuu1" and "cuf1" respectively) but the
keys you'd expect to be for the down and left arrows actually give what
*output* characters you need to produce those motions.
You can check this by:
infocmp xterm | grep '\[[ABCD]'
and observe the definitions for the right and up, and the lack of the
left and down.
And the definitions for the arrow keys - kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC,
kcuu1=\EOA aren't actually generated from the arrow keys (as
demonstrated by the cat -tvu experiment).
Anyone know what these keys are supposed to be on the keyboard? If
they really were what the arrow keys on the keyboard generated, there'd
be no problem.
Come to think of it, I've had to add these definitions to my
.Xresources file for Home and End to match the xterm definition:
*VT100.Translations: #override \
BackSpace: string(\010) \n\
<Key>KP_8: scroll-back(1, line) \n\
<Key>KP_2: scroll-forw(1, line) \n\
<Key>Prior: scroll-back(1, page) \n\
<Key>Next: scroll-forw(1, page) \n\
<Key>KP_9: scroll-back(1, page) \n\
<Key>KP_3: scroll-forw(1, page) \n\
<Key>Home: string(0x1b) string("[1~")\n\
<Key>End: string(0x1b) string("[4~")
Is *that* what's causing the confusion, somehow?
Over the years, for every Linux system I've had, I've ported a
historical visual editor that my brother and I wrote, and which my wife
is addicted too, and I've `corrected' the definitions for xterm in the
termcap database to match the character sequence generated by the keys.
But with RH6.2 that confused the hell out of vi and other programs, so
I at last woke up to the idea that it wasn't the termcap or terminfo
databases that were broken, it was my understanding.
So on Sunday I ported it to use terminfo using the termios interface,
and everything is now working fine - except for the down and left arrow
keys. Which makes sense to me, because there are no definitions for
them!
Any advice?
luke
--
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://slug.org.au/lists/listinfo/slug