|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
<HTML>
|
|
Packit Service |
50ad14 |
<HEAD>
|
|
Packit Service |
50ad14 |
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
|
|
Packit Service |
50ad14 |
<TITLE>The Linux keyboard and console HOWTO: Delete and Backspace</TITLE>
|
|
Packit Service |
50ad14 |
<LINK HREF="kbd.FAQ-6.html" REL=next>
|
|
Packit Service |
50ad14 |
<LINK HREF="kbd.FAQ-4.html" REL=previous>
|
|
Packit Service |
50ad14 |
<LINK HREF="kbd.FAQ.html#toc5" REL=contents>
|
|
Packit Service |
50ad14 |
</HEAD>
|
|
Packit Service |
50ad14 |
<BODY>
|
|
Packit Service |
50ad14 |
Next
|
|
Packit Service |
50ad14 |
Previous
|
|
Packit Service |
50ad14 |
Contents
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
delete key!problems with
|
|
Packit Service |
50ad14 |
-->
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
backspace key!problems with
|
|
Packit Service |
50ad14 |
-->
|
|
Packit Service |
50ad14 |
Getting Delete and Backspace to work just right is nontrivial,
|
|
Packit Service |
50ad14 |
especially in a mixed environment, where you talk to console,
|
|
Packit Service |
50ad14 |
to X , to bash , to emacs , login remotely, etc.
|
|
Packit Service |
50ad14 |
You may have to edit several configuration files to tell all
|
|
Packit Service |
50ad14 |
of the programs involved precisely what you want.
|
|
Packit Service |
50ad14 |
On the one hand, there is the matter of which keys generate
|
|
Packit Service |
50ad14 |
which codes (and how these codes are remapped by e.g. kermit
|
|
Packit Service |
50ad14 |
or emacs ), and on the other hand the question of what functions
|
|
Packit Service |
50ad14 |
are bound to what codes.
|
|
Packit Service |
50ad14 |
People often complain `my backspace key does not work', as if this
|
|
Packit Service |
50ad14 |
key had a built-in function `delete previous character'.
|
|
Packit Service |
50ad14 |
Unfortunately, all this key, or any key, does is producing a code,
|
|
Packit Service |
50ad14 |
and one only can hope that the kernel tty driver and
|
|
Packit Service |
50ad14 |
all application programs can be configured such that
|
|
Packit Service |
50ad14 |
the backspace key indeed does function as a `delete previous character'
|
|
Packit Service |
50ad14 |
key.
|
|
Packit Service |
50ad14 |
Most Unix programs get their tty input via the kernel tty driver
|
|
Packit Service |
50ad14 |
in `cooked' mode, and a simple stty command determines the
|
|
Packit Service |
50ad14 |
erase character. However, programs like bash and emacs
|
|
Packit Service |
50ad14 |
and X do their own input handling, and have to be convinced
|
|
Packit Service |
50ad14 |
one-by-one to do the right thing.
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
stty!using to set erase character
|
|
Packit Service |
50ad14 |
-->
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
% stty erase ^?
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
If the character is erased, but in a funny way, then something is
|
|
Packit Service |
50ad14 |
wrong with your tty settings. If echoprt is set, then erased characters
|
|
Packit Service |
50ad14 |
are enclosed between \ and / .
|
|
Packit Service |
50ad14 |
If echoe is not set, then the erase char is echoed
|
|
Packit Service |
50ad14 |
(which is reasonable when it is a printing character, like #).
|
|
Packit Service |
50ad14 |
Most people will want stty echoe -echoprt . Saying stty sane
|
|
Packit Service |
50ad14 |
will do this and more. Saying stty -a shows your current settings.
|
|
Packit Service |
50ad14 |
How come this is not right by default? It is, if you use the right
|
|
Packit Service |
50ad14 |
getty .
|
|
Packit Service |
50ad14 |
Note that many programs (like bash , emacs etc.) have their own
|
|
Packit Service |
50ad14 |
keybindings (defined in ~/.inputrc ,
|
|
Packit Service |
50ad14 |
~/.emacs etc.) and are unaffected by the setting
|
|
Packit Service |
50ad14 |
of the erase character.
|
|
Packit Service |
50ad14 |
The standard Unix tty driver does not recognize a cursor, or keys
|
|
Packit Service |
50ad14 |
(like the arrow keys) to move the current position, and hence does not
|
|
Packit Service |
50ad14 |
have a command `delete current character' either. But for example
|
|
Packit Service |
50ad14 |
you can get bash on the console to recognize the Delete key by putting
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
set editing-mode emacs
|
|
Packit Service |
50ad14 |
"\e[3~":delete-char
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
into ~/.inputrc .
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
`Getty used to do the right thing with DEL and BS but is broken now?'
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
getty!problems with BS and DEL
|
|
Packit Service |
50ad14 |
-->
|
|
Packit Service |
50ad14 |
Earlier, the console driver would do BS Space BS
|
|
Packit Service |
50ad14 |
(\010\040\010 )
|
|
Packit Service |
50ad14 |
when it got a DEL (\177 ).
|
|
Packit Service |
50ad14 |
Nowadays, DEL's are ignored (as they should be,
|
|
Packit Service |
50ad14 |
since the driver emulates a vt100). Get a better getty, i.e.,
|
|
Packit Service |
50ad14 |
one that does not output DEL.
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
`Login behaves differently at the first and second login attempts?'
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
login!problems with BS and DEL
|
|
Packit Service |
50ad14 |
-->
|
|
Packit Service |
50ad14 |
At the first attempt, you are talking to getty . At the second attempt,
|
|
Packit Service |
50ad14 |
you are talking to login , a different program.
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
keyboard!keycode remapping
|
|
Packit Service |
50ad14 |
-->
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
keycode remapping
|
|
Packit Service |
50ad14 |
-->
|
|
Packit Service |
50ad14 |
On the console, or, more precisely, when not in (MEDIUM)RAW mode, use
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
% loadkeys mykeys.map
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
and under X use
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
% xmodmap mykeys.xmap
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
Note that (since XFree86-2.1) X reads the Linux settings of the keymaps
|
|
Packit Service |
50ad14 |
when initialising the X keymap. Although the two systems are not
|
|
Packit Service |
50ad14 |
100% compatible, this should mean that in many cases the use of
|
|
Packit Service |
50ad14 |
xmodmap has become superfluous.
|
|
Packit Service |
50ad14 |
For example, suppose that you would like the Backspace key
|
|
Packit Service |
50ad14 |
to send a BackSpace (Ctrl-H, octal 010) and the grey Delete key
|
|
Packit Service |
50ad14 |
a DEL (octal 0177). Add the following to /etc/rc.local
|
|
Packit Service |
50ad14 |
(or wherever you keep your local boot-time stuff):
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
/usr/bin/loadkeys << EOF
|
|
Packit Service |
50ad14 |
keycode 14 = BackSpace
|
|
Packit Service |
50ad14 |
keycode 111 = Delete
|
|
Packit Service |
50ad14 |
EOF
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
Note that this will only change the function of these keys
|
|
Packit Service |
50ad14 |
when no modifiers are used. (You need to specify a keymaps line
|
|
Packit Service |
50ad14 |
to tell which keymaps should be affected if you want to change
|
|
Packit Service |
50ad14 |
bindings on more keymaps.)
|
|
Packit Service |
50ad14 |
The Linux kernel default lets
|
|
Packit Service |
50ad14 |
Ctrl-Backspace generate BackSpace - this is sometimes useful
|
|
Packit Service |
50ad14 |
as emergency escape, when you find you can only generate DELs.
|
|
Packit Service |
50ad14 |
The left Alt key is sometimes called the Meta key, and by
|
|
Packit Service |
50ad14 |
default the combinations AltL-X are bound to the symbol MetaX.
|
|
Packit Service |
50ad14 |
But what character sequence is MetaX?
|
|
Packit Service |
50ad14 |
That is determined (per-tty) by the Meta flag, set by the command
|
|
Packit Service |
50ad14 |
setmetamode . The two choices are: ESC X or X or-ed with 0200.
|
|
Packit Service |
50ad14 |
Many distributions have a loadkeys command somewhere in the
|
|
Packit Service |
50ad14 |
bootup sequence. For example, one may have the name of the desired
|
|
Packit Service |
50ad14 |
keymap in /etc/sysconfig/keyboard and the loadkeys
|
|
Packit Service |
50ad14 |
command that loads it in /etc/rc.d/init.d/keytable .
|
|
Packit Service |
50ad14 |
Or one may have the actual default keymap in /etc/default.keytab
|
|
Packit Service |
50ad14 |
and the loadkeys command that loads it in /etc/rc.d/boot .
|
|
Packit Service |
50ad14 |
Etc. Instead of adding a local modification to the default, one can
|
|
Packit Service |
50ad14 |
of course change the default by editing the default keymap or changing
|
|
Packit Service |
50ad14 |
the name of the keymap to be loaded at boot time. Note that loadkeys
|
|
Packit Service |
50ad14 |
itself has default keymap defkeymap.map located somewhere under
|
|
Packit Service |
50ad14 |
/usr/lib/kbd or /usr/share/kbd (just like all other
|
|
Packit Service |
50ad14 |
keymaps) and this may not yet be available in single user boot before
|
|
Packit Service |
50ad14 |
/usr has been mounted.
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
`How do I get a dvorak keyboard?'
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
dvorak keyboard
|
|
Packit Service |
50ad14 |
-->
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
The command
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
% loadkeys dvorak
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
will give you a dvorak layout, probably by loading
|
|
Packit Service |
50ad14 |
something like /usr/lib/kbd/keymaps/i386/dvorak/dvorak.map.gz .
|
|
Packit Service |
50ad14 |
Under X , put
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
XkbLayout "dvorak"
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
in XF86Config .
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
`Why doesn't the Backspace key generate BackSpace by default?'
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
backspace key!not generating correct keycode
|
|
Packit Service |
50ad14 |
-->
|
|
Packit Service |
50ad14 |
(i) Because the VT100 had a Delete key above the Enter key.
|
|
Packit Service |
50ad14 |
(ii) Because Linus decided so.
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
X!swapping DEL, BS
|
|
Packit Service |
50ad14 |
-->
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
xmodmap!using to swap DEL, BS
|
|
Packit Service |
50ad14 |
-->
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
% xmodmap -e "keysym BackSpace = Delete" -e "keysym Delete = BackSpace"
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
Or, if you just want the Backspace key to generate a BackSpace:
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
% xmodmap -e "keycode 22 = BackSpace"
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
Or, if you just want the Delete key to generate a Delete:
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
% xmodmap -e "keycode 107 = Delete"
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
(but usually this is the default binding already).
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
emacs!binding DEL, BS
|
|
Packit Service |
50ad14 |
-->
|
|
Packit Service |
50ad14 |
Put in your .emacs file lines like
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
(global-set-key "\?" 'help-command)
|
|
Packit Service |
50ad14 |
(global-set-key "\C-h" 'delete-backward-char)
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
Of course you can bind other commands to other keys in the same way.
|
|
Packit Service |
50ad14 |
Note that various major and minor modes redefine keybindings.
|
|
Packit Service |
50ad14 |
For example, in incremental search mode one finds the code
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
(define-key map "\177" 'isearch-delete-char)
|
|
Packit Service |
50ad14 |
(define-key map "\C-h" 'isearch-mode-help)
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
This means that it may be a bad idea to use the above two
|
|
Packit Service |
50ad14 |
global-set-key commands. There are too many places where
|
|
Packit Service |
50ad14 |
there are built-in assumptions about Ctrl-H = help and DEL = delete.
|
|
Packit Service |
50ad14 |
That doesn't mean that you have to setup keys so that Backspace
|
|
Packit Service |
50ad14 |
generates DEL. But if it doesn't then it is easiest to remap
|
|
Packit Service |
50ad14 |
them at the lowest possible level in emacs.
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
emacs!swapping DEL, BS
|
|
Packit Service |
50ad14 |
-->
|
|
Packit Service |
50ad14 |
Put in your .emacs file lines
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
(setq keyboard-translate-table (make-string 128 0))
|
|
Packit Service |
50ad14 |
(let ((i 0))
|
|
Packit Service |
50ad14 |
(while (< i 128)
|
|
Packit Service |
50ad14 |
(aset keyboard-translate-table i i)
|
|
Packit Service |
50ad14 |
(setq i (1+ i))))
|
|
Packit Service |
50ad14 |
(aset keyboard-translate-table ?\b ?\^?)
|
|
Packit Service |
50ad14 |
(aset keyboard-translate-table ?\^? ?\b)
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
Recent versions of emacs have a function keyboard-translate
|
|
Packit Service |
50ad14 |
and one may simplify the above to
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
(keyboard-translate ?\C-h ?\C-?)
|
|
Packit Service |
50ad14 |
(keyboard-translate ?\C-? ?\C-h)
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
Note that under X emacs can distinguish between Ctrl-h and the
|
|
Packit Service |
50ad14 |
Backspace key (regardless of what codes these produce on the console),
|
|
Packit Service |
50ad14 |
and by default emacs will view the Backspace key as DEL
|
|
Packit Service |
50ad14 |
(and do deletion things, as bound to that character, rather than
|
|
Packit Service |
50ad14 |
help things, bound to Ctrl-H). One can distinguish Backspace and Delete,
|
|
Packit Service |
50ad14 |
e.g. by
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
(global-unset-key [backspace] )
|
|
Packit Service |
50ad14 |
(global-set-key [backspace] 'delete-backward-char)
|
|
Packit Service |
50ad14 |
(global-unset-key [delete] )
|
|
Packit Service |
50ad14 |
(global-set-key [delete] 'delete-char)
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
kermit!swapping DEL, BS
|
|
Packit Service |
50ad14 |
-->
|
|
Packit Service |
50ad14 |
Put in your .kermrc file the lines
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
set key \127 \8
|
|
Packit Service |
50ad14 |
set key \8 \127
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
xterm!swapping DEL, BS
|
|
Packit Service |
50ad14 |
-->
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
XTerm*VT100.Translations: #override\n\
|
|
Packit Service |
50ad14 |
<KeyPress> BackSpace : string(0x7f)\n\
|
|
Packit Service |
50ad14 |
<KeyPress> Delete : string(0x08)\n
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
xterm!setting tty modes for
|
|
Packit Service |
50ad14 |
-->
|
|
Packit Service |
50ad14 |
Normally xterm will inherit the tty modes from its invoker.
|
|
Packit Service |
50ad14 |
Under xdm , the default erase and kill characters are # and @ ,
|
|
Packit Service |
50ad14 |
as in good old Unix Version 6.
|
|
Packit Service |
50ad14 |
If you don't like that, you might put something like
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
XTerm*ttymodes: erase ^? kill ^U intr ^C quit ^\ eof ^D \
|
|
Packit Service |
50ad14 |
susp ^Z start ^Q stop ^S eol ^@
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
in /usr/lib/X11/app-defaults/XTerm or in
|
|
Packit Service |
50ad14 |
$HOME/.Xresources , assuming that you have a line
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
xrdb -merge $HOME/.Xresources
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
in your $HOME/.xinitrc or $HOME/.xsession .
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
Put
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
*Text.translations: #override \
|
|
Packit Service |
50ad14 |
~Shift ~Meta <Key>Delete: delete-next-character()
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
into .Xresources to make non-Motif X applications such as
|
|
Packit Service |
50ad14 |
xfig , xedit , etc., work correctly. (Daniel T. Cobra)
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
xmosaic!remapping BS key
|
|
Packit Service |
50ad14 |
-->
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
Netscape!remapping BS
|
|
Packit Service |
50ad14 |
-->
|
|
Packit Service |
50ad14 |
Putting
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
*XmText.translations: #override\n\
|
|
Packit Service |
50ad14 |
<Key>osfDelete: delete-previous-character()
|
|
Packit Service |
50ad14 |
*XmTextField.translations: #override\n\
|
|
Packit Service |
50ad14 |
<Key>osfDelete: delete-previous-character()
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
in your $HOME/.Xdefaults or
|
|
Packit Service |
50ad14 |
$HOME/.Xresources helps.
|
|
Packit Service |
50ad14 |
(What file? The file that is fed to xrdb , for example
|
|
Packit Service |
50ad14 |
in .xinitrc .)
|
|
Packit Service |
50ad14 |
The netscape FAQ, however, says:
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
Why doesn't my Backspace key work in text fields?
|
|
Packit Service |
50ad14 |
By default, Linux and XFree86 come with the Backspace and Delete keys
|
|
Packit Service |
50ad14 |
misconfigured. All Motif programs (including, of course, Netscape
|
|
Packit Service |
50ad14 |
Navigator) will malfunction in the same way.
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
The Motif spec says that Backspace is supposed to delete the previous
|
|
Packit Service |
50ad14 |
character and Delete is supposed to delete the following character.
|
|
Packit Service |
50ad14 |
Linux and XFree86 come configured with both the Backspace and Delete
|
|
Packit Service |
50ad14 |
keys generating Delete.
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
You can fix this by using any one of the xmodmap, xkeycaps, or
|
|
Packit Service |
50ad14 |
loadkeys programs to make the key in question generate the BackSpace
|
|
Packit Service |
50ad14 |
keysym instead of Delete.
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
You can also fix it by having a .motifbind file; see the man page
|
|
Packit Service |
50ad14 |
for VirtualBindings(3).
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
Note: Don't use the *XmText.translations or *XmTextField.translations
|
|
Packit Service |
50ad14 |
resources to attempt to fix this problem. If you do, you will blow
|
|
Packit Service |
50ad14 |
away Netscape Navigator's other text-field key bindings.
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
Netscape!remapping BS
|
|
Packit Service |
50ad14 |
-->
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
Motif!remapping BS
|
|
Packit Service |
50ad14 |
-->
|
|
Packit Service |
50ad14 |
Ted Kandell (ted@tcg.net ) suggests the following:
|
|
Packit Service |
50ad14 |
Somewhere in your .profile add the following:
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
stty erase ^H
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
If you are using bash , add the following lines to your .inputrc :
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
"\C-?": delete-char
|
|
Packit Service |
50ad14 |
"\C-h": backward-delete-char
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
Add the following lines to your .xinitrc file:
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
xmodmap <<-EOF
|
|
Packit Service |
50ad14 |
keycode 22 = BackSpace osfBackSpace
|
|
Packit Service |
50ad14 |
keycode 107 = Delete
|
|
Packit Service |
50ad14 |
EOF
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
# start your window manager here, for example:
|
|
Packit Service |
50ad14 |
#(fvwm) 2>&1 | tee /dev/tty /dev/console
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
stty sane
|
|
Packit Service |
50ad14 |
stty erase ^H
|
|
Packit Service |
50ad14 |
loadmap <<-EOF
|
|
Packit Service |
50ad14 |
keycode 14 = BackSpace
|
|
Packit Service |
50ad14 |
keycode 111 = Delete
|
|
Packit Service |
50ad14 |
EOF
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
This will definitely work for a PC 101 or 102 key keyboard
|
|
Packit Service |
50ad14 |
with any Linux/XFree86 layout.
|
|
Packit Service |
50ad14 |
The important part to making Motif apps like Netscape work properly
|
|
Packit Service |
50ad14 |
is adding osfBackSpace to keycode 22 in addition to BackSpace.
|
|
Packit Service |
50ad14 |
Note that there must be spaces on either side of the = sign.
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
termcap!remapping BS with
|
|
Packit Service |
50ad14 |
-->
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
terminfo!remapping BS with
|
|
Packit Service |
50ad14 |
-->
|
|
Packit Service |
50ad14 |
When people have problems with backspace, they tend to look at their termcap
|
|
Packit Service |
50ad14 |
(or terminfo) entry for the terminal, and indeed, there does exist a kb
|
|
Packit Service |
50ad14 |
(or kbs) capability describing the code generated by the Backspace key.
|
|
Packit Service |
50ad14 |
However, not many programs use it, so unless you are having problems with one
|
|
Packit Service |
50ad14 |
particular program only, probably the fault is elsewhere.
|
|
Packit Service |
50ad14 |
Of course it is a good idea anyway to correct your termcap (terminfo) entry.
|
|
Packit Service |
50ad14 |
See also below under "The TERM variable".
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
There are many possibilities to get a functioning system.
|
|
Packit Service |
50ad14 |
Can't you give one complete set of settings that works?
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
delete key!a solution
|
|
Packit Service |
50ad14 |
-->
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
backspace key!a solution
|
|
Packit Service |
50ad14 |
-->
|
|
Packit Service |
50ad14 |
One way of getting a setup that works in all contexts
|
|
Packit Service |
50ad14 |
is to have the Backspace key generate DEL when on the
|
|
Packit Service |
50ad14 |
console (or xterm), and BackSpace when under X.
|
|
Packit Service |
50ad14 |
Maybe that is most convenient - there are too many X utilities
|
|
Packit Service |
50ad14 |
that expect BackSpace, and emacs on the console or xterm
|
|
Packit Service |
50ad14 |
expects DEL, while emacs under X can distinguish [BackSpace]
|
|
Packit Service |
50ad14 |
from Ctrl-H and does the right thing.
|
|
Packit Service |
50ad14 |
What is needed?
|
|
Packit Service |
50ad14 |
No loadkeys changes, since the Backspace key already generates
|
|
Packit Service |
50ad14 |
DEL by default. No stty settings, they are OK by default.
|
|
Packit Service |
50ad14 |
No X settings, they are OK by default.
|
|
Packit Service |
50ad14 |
One just has to tell xterm that the Backspace key should generate DEL:
|
|
Packit Service |
50ad14 |
put
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
XTerm*VT100.Translations: #override\n\
|
|
Packit Service |
50ad14 |
<KeyPress> BackSpace : string(0x7f)\n\
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
in .Xresources , and
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
xrdb -merge .Xresources
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
in .xinitrc , and you are settled.
|
|
Packit Service |
50ad14 |
For a much more extensive discussion of these things, and
|
|
Packit Service |
50ad14 |
alternative solutions, see
|
|
Packit Service |
50ad14 |
Anne Baretta's page.
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
Next
|
|
Packit Service |
50ad14 |
Previous
|
|
Packit Service |
50ad14 |
Contents
|
|
Packit Service |
50ad14 |
</BODY>
|
|
Packit Service |
50ad14 |
</HTML>
|