Re: gnome-terminal: "DEL"-key behaviour



alexander volovics <awol@STAT.UNIMAAS.NL> writes:

> On 01-Apr-99 Miguel de Icaza wrote:
> > 
> >> I'm used to the usual behaviour of the DEL key. The key is supposed to
> >> delete the character at the cursor position and not the one that is left
> >> to the cursor. I know, it's stupid, but it is just my habit by now to use
> >> the DEL-key to edit commands from the history. So where can I change
> >> this? 
> > 
> > Go to the preferences page, and click on the "Swap DEL/Backspace"
> > keys.
> 
> This does NOT work!
> I too would like to know how to make:
> 1) the delete key delete the character under the cursor and then stay in 
>    position and not move backward like the backspace key.
> 2) the backspace key delete by moving backwards, i.e. to the 'left'.
> 
> Where and how can you configure this.
> 
> Neither under SuSE nor under RH 5.2 have I been able to find a way to do
> this in gnome-terminal/bash.
> It works perfectly in for example gedit.

OK, but a terminal is a completely different thing. There are a lot of 
places where different layers may change the meaning of the "what you
press on your keyboard" and "what appears on the screen".

Even on a console (aka "text mode") there is libreadline (in the case
of bash), termcap or terminfo and maybe the program itself which all
can be tweaked (and must be tweaked) to get the desired behaviour..

under X there is at least the additional layer of X itself that may
change what programs finally "see" from what you press on the
keyboard. 

with other words: to make the terminal work right, you have to tweak
bash/readline. gnome-terminal itself should be OK without the swapping 
of DEL/Backspace set.

for example I have the following in my .bashrc


bind '"\e[1~": beginning-of-line'
bind '"\e[3~": delete-char'        ### this is on the console...
bind '"\e[4~": end-of-line'        ### in X there will be no \e3~ sent 
                                   ### for the DEL key. Yes, this is stupid

if [ $TERM = 'xterm' ]; then 
   export PROMPT_COMMAND='echo -ne "\033]2;"`whoami`@`hostname`"\007"'   
   bind '"\C-?": delete-char'      ### this is what under X will be seen
   stty erase ^H
fi



Don't expect a real good explanation of this stuff from me; terminal
escape codes, keycodes, scancodes, terminfo, termcap, readline and all 
this has a burden of a long history and I still don't really
understand it. the above works for me and before I'm beaten I can give 
some kind of explanation why it does, but I wouldn't bet on this
explanation being the whole truth :-)

 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]