I'm writing to try and address the issue of the
home/end/del/backspace keys in xterm and rxvt. Out of the
box these keys don't work correctly with RedHat Linux. It
turns out the issues are quite involved:
Here's a summary of my findings:
1/ The 'nxterm' shipped with RedHat seems to be a branch of
an old version of xterm that contains a bug wrt to the
2/ The 'xterm' termcap/terminfo entries for home/end do not
match the actual codes generated by xterm.
3/ The 'xterm' termcap/terminfo entries for del/bs do not
match the actual codes generated by rxvt.
4/ The termcap/terminfo entries for 'xterm' contain
non-standard codes, which I believe is undesirable.
5/ Given that xterm and rxvt generate different codes for
these keys, it's necessary to either: a) use
app-default/Xterm or app-defaults/Rxvt to map one program's
keys onto the other, or b) Get rxvt to set TERM=rxvt rather
I believe that finding the best solution requires some
discussion. Could someone from RedHat please contact me so
I can offer my proposal.
Hoping you are listening...
1. what is the nature of the bug in nxterm ?
2. is there a patch available ?
3. is there a patch available ?
4. Which codes are non standard ?
5. 'rxvt' is not a "common" terminal name and it will interract badly
when Linux is used in in a mixed environment, with other unices
around. I'd rather make rxvt match the xterm keys, altough I am not
sure how many apps that already know about rxvt will be broken by
1. According to the current xterm maintainer, Thomas E. Dickey
(email@example.com), older versions of xterm had an array indexing bug.
The home/end keys generated garbage. nxterm seems to be a fork of an
old xterm and therefore has this bug. In the case of the nxterm
binaries shipped with RedHat 5.1, home generates \E[^@ and end
Nobody has been able to tell me exactly what nxterm does. I suspect it
may be obsolete. Certainly color_xterm (another variant, possibly
related to nxterm) is obsolete since xterm itself has had color
capabilities for some time.
2. This bug was fixed in xterm for the XFree86 distribution in 1996.
The values xterm generates for home/end are \EOH and \EOF.
My proposal is this:
1. Accept that the 'correct' codes for home/end/backspace/del are
those generated by xterm: \EOH, \EOF, ^H, and \E[3~.
2. Anything that claims to be xterm compatible should generate the
same codes as xterm. I can't understand the rationale for rxvt setting
TERM=xterm and then generating different keycodes, it's crazy.
3. Reset the xterm termcap/terminfo entries to the 'correct' values.
The values being obtained from the XFree86 distribution, or from the
master terminfo sources currently maintained by Eric S Raymond.
4. Consider scrapping nxterm and color_xterm. What do they do? If they
must be kept, try app-defaults/NXTerm to get correct values. I'm
unsure if the array indexing bug can be worked around like this, I
haven't tried it.
a) Make rxvt set TERM=rxvt, then it can generate whatever codes it
b) Use app-defaults/Rxvt to get it to generate xterm compatible codes.
I know many people prefer the TERM=rxvt solution, but I'm not sure I
want to comment. Either solution would work for me.
7. Finally, lose the default mapping that makes PgUp/PgDn scroll the
xterm window. It's a pain in the bum when using full screen apps such
as Midnight Commander. I have observed that this is particularly
confusing for new users.
If you would like me to do any further research I'd be happy to do so.
I'm working on this.
fixed in ncurses-4.2-17 and later.