LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Delete key not working in terminal emulators (https://www.linuxquestions.org/questions/slackware-14/delete-key-not-working-in-terminal-emulators-694074/)

statguy 12-31-2008 10:34 AM

Delete key not working in terminal emulators
 
I am used to my delete key deleting the character at the current cursor position. Mine does this except in terminal emulators such as Konsole and xterm.

I'm on a Thinkpad T60 and Slackware 12.2. Here is the keyboard section of my xorg.conf

Code:

Section "InputDevice"
        Identifier  "Keyboard0"
        Driver      "kbd"
        Option      "XkbModel" "pc105"
        Option      "XkbLayout" "us"
EndSection

I have tried different keyboard "themes" in Konsole and none of them work. I have tried different XkbModel choices too (pc104 and thinkpad60 to be specific). In everything but the terminal emulators the key works, but in a terminal all I see is a ~ when I press delete. BTW, Ctrl-D does do a delete.

I assume I must need an .Xmodmap entry for the key, but I'm not sure how to do this. Specifically, how do I determine what keycode my delete is generating? Or is there something else I should look at?

BCarey 12-31-2008 10:52 AM

Quote:

Originally Posted by statguy (Post 3392682)
Specifically, how do I determine what keycode my delete is generating?

run xev and then press your delete key, and you'll see the keycode in the output.

BTW, my delete key works in all the terminal emulators and I didn't do anything to configure it.

Brian

statguy 12-31-2008 11:15 AM

Quote:

Originally Posted by BCarey (Post 3392696)
run xev and then press your delete key, and you'll see the keycode in the output.

Thanks, I'll try that.

Quote:

Originally Posted by BCarey (Post 3392696)
BTW, my delete key works in all the terminal emulators and I didn't do anything to configure it.

Of course it does. :) I have a knack for odd problems even when I do a full install.

GazL 12-31-2008 12:31 PM

Try the following on the command line, after entering each cat|od command press
DEL enter ctrl-d. If your delete key is working you should get something similar to this.

Code:

bash-3.1$ echo $TERM
xterm
bash-3.1$ cat | od -tx1c
^[[3~
0000000 1b 5b 33 7e 0a
        033  [  3  ~  \n
0000005
bash-3.1$ cat -v | od -tx1c
^[[3~
0000000 5e 5b 5b 33 7e 0a
          ^  [  [  3  ~  \n
0000006
bash-3.1$

Not all tty based commands support line editing, so it might help if you give us a little more detail of what you're trying to run when it doesn't work, but the above will give us a clue that your key is at least generating reasonable control sequences.

You may also want to ensure your $TERM is set appropriately for the type of terminal you're using.

statguy 12-31-2008 01:25 PM

Quote:

Originally Posted by GazL (Post 3392770)
Not all tty based commands support line editing, so it might help if you give us a little more detail of what you're trying to run when it doesn't work, but the above will give us a clue that your key is at least generating reasonable control sequences.

You may also want to ensure your $TERM is set appropriately for the type of terminal you're using.

Well, I did say it worked fine except for terminal emulators such as Konsole or xterm. That said, here are the results in a Konsole.

Code:

$ echo $TERM
xterm
$ cat | od -tx1c
^[[3~
0000000 1b 5b 33 7e 0a
        033  [  3  ~  \n
0000005
$ cat -v | od -tx1c
^[[3~
0000000 5e 5b 5b 33 7e 0a
          ^  [  [  3  ~  \n
0000006

Running this in a non-x tty gives the same results except the $TERM variable is linux.

When I saw that, I did

Code:

export TERM=linux
in my Konsole window and the Delete key behaves.

So, since I have the same problem in an actual xterm, does this mean there is a problem with the xterm terminal type for my system?

Should I therefore set TERM to linux in my .bashrc?

statguy 12-31-2008 01:51 PM

Just to follow-up. After the discovery that my delete key worked with TERM=linux I went into the Konsole configuration dialog. There is a spot to set the TERM variable. After some trial and error I determined that with $TERM=linux and the Keytab as XTerm (XFree 4.x.x) my keys work as intended.

Thanks for the suggestions that put me on this path.


All times are GMT -5. The time now is 11:05 AM.