<<< Date Index >>>     <<< Thread Index >>>

Re: Backspace key



On Thu, Jun 07, 2007 at 12:14:42PM -0600, Kyle Wheeler wrote:
>      stty erase ^?
> 
> Don't just type in a carot (^) and a question mark (?) though, because 
> that's not the same thing. 

Actually, it is.  Or rather it isn't, but stty still knows what you
mean.  From the info page for GNU stty:

  Special characters
  ------------------

     The special characters' default values vary from system to
     system.  They are set with the syntax `name value', where the
     names are listed below and the value can be given either
     literally, in hat notation (`^C'), or as an integer which may
     start with `0x' to indicate hexadecimal, `0' to indicate octal,
     or any other digit to indicate decimal.

Should work likewise on any sane Unix system without GNU utils too.
Check your system's manpage for stty if you're not on Linux.

Adam,

You will probably find this document useful:

  http://tldp.org/HOWTO/Keyboard-and-Console-HOWTO-5.html

The "right" way to fix depends... it may well be the above.  If it's
wrong running programs locally on your system, it probably means that
your termcap/terminfo database entries for your terminal type are
wrong.  Reasonably modern systems should be using terminfo, primarily,
though for the sake of consistency, both entries should match.

If it only happens when logged into a remote machine, you're probably
stuck with fixing it temporarily.  Most Unix systems' xterm
terminfo/termcap entries define backspace as ^H, but Linux has decided
that the correct value is ^?.  This means when you log into something
other than Linux from Linux, you have a mismatch.  Those other systems
typically use ^? as delete, but Linux has designated '^[[3~' as the
delete sequence.  The only way to solve it permanently is to change
your termcap/terminfo entries (on every system you use) to match each
other.  You probably won't be able to do that, since you'll need root
access on all the machines involved,  so you'll be stuck with using
stty to set it on a case-by-case basis.

And it's probably not a good idea to do it, even if you can do it,
because it will likely cause everyone else pain.

One thing you can do is tell your xterm programs to use a custom
termcap type using the Xterm.termName resource, or using the -tn
command line option.  For example, you could launch your xterms as
such:

  xterm -tn xterm-adam

Then you'll need to do something fancy... What to do then is kind of
up to you.  You'll need to create termcap/terminfo entries for
xterm-adam by copying the xterm entries to xterm-adam, and modify the
backspace and delete resources to match what you have on your local
system.  Or, rather than modifying the entries, you can just copy
them, and then check your term type in your .profile/bashrc etc. and
use stty to set the right values based on your terminal type.

See the document I linked above for more specifics.  The O'Reilly book
on termcap/terminfo has all the gory details.  You can also get most
of the info from the man pages on termcap and terminfo, as well as all
the pages they refer to.

HTH

-- 
Derek D. Martin    http://www.pizzashack.org/   GPG Key ID: 0xDFBEAD02
-=-=-=-=-
This message is posted from an invalid address.  Replying to it will result in
undeliverable mail due to spam prevention.  Sorry for the inconvenience.

Attachment: pgpSh6P33Em7R.pgp
Description: PGP signature