Go Back  Mac-Forums.com  > Software > OS X - Darwin and Development > Delete Key Doesn't Work in xterm - How to Fix It?

Reply
 
LinkBack Thread Tools
Old 06-07-2006, 02:52 PM   #1 (permalink)
mac57

 
mac57's Avatar
 
Member Since: Apr 29, 2006
Location: St. Somewhere
Posts: 4,529
mac57 has a brilliant futuremac57 has a brilliant futuremac57 has a brilliant futuremac57 has a brilliant futuremac57 has a brilliant futuremac57 has a brilliant futuremac57 has a brilliant futuremac57 has a brilliant futuremac57 has a brilliant futuremac57 has a brilliant futuremac57 has a brilliant future
Mac Specs: Mac Pro, 3.2 GHz 8 Core, 8 GB RAM, 2*750 GB Disk, nVidia 8800 GT
Delete Key Doesn't Work in xterm - How to Fix It?

I am running Apple's X11. From within an xterm, when I press the Delete key, I get a nasty key code that xterm doesn't recognize as delete. I would like to remap that so that it works as intended. As an example, this would remap the Backspace key:

xmodmap -e "keycode 59 = BackSpace"

What is the magic keycode and word for Delete? Something along the lines of:

xmodmap -e "keycode xy = Delete" ?

In this case, what is the value of "xy", and is "Delete" the correct keyword?

Thanks!
__________________
My Macs: Mac Pro, 3.2 GHz 8 Core, MacBook Pro, 2.2 GHz C2D
My iStuff: 32 GB iPhone 3G S, 30 GB iPod Video, 16 GB iPod Touch
My OS': Mac OS X Leopard, Mac OS X Tiger, openSUSE 10.3, Win XP
I was on the Mac-Forums honor roll for September 2007
mac57 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Stumble this post
Reply With Quote
Old 06-07-2006, 04:30 PM   #2 (permalink)
rman

 
rman's Avatar
 
Member Since: Dec 24, 2002
Location: Los Angeles, California
Posts: 12,190
rman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud of
Mac Specs: 2 x 3.0GHz Quad-Core, 6GB OS X 10.5.7
Cool

If the delete key functions the same way as the backspace key. Then this is what I do at the command line.

stty erase deletekey
__________________
Life isn't about waiting for the storm to pass, It's about learning to dance in the rain!
rman is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Stumble this post
Reply With Quote
Old 06-07-2006, 05:16 PM   #3 (permalink)
mac57

 
mac57's Avatar
 
Member Since: Apr 29, 2006
Location: St. Somewhere
Posts: 4,529
mac57 has a brilliant futuremac57 has a brilliant futuremac57 has a brilliant futuremac57 has a brilliant futuremac57 has a brilliant futuremac57 has a brilliant futuremac57 has a brilliant futuremac57 has a brilliant futuremac57 has a brilliant futuremac57 has a brilliant futuremac57 has a brilliant future
Mac Specs: Mac Pro, 3.2 GHz 8 Core, 8 GB RAM, 2*750 GB Disk, nVidia 8800 GT
Nope, that didn't do it! I opened an xterm and tried this, but I still get junk when I press the delete key.
__________________
My Macs: Mac Pro, 3.2 GHz 8 Core, MacBook Pro, 2.2 GHz C2D
My iStuff: 32 GB iPhone 3G S, 30 GB iPod Video, 16 GB iPod Touch
My OS': Mac OS X Leopard, Mac OS X Tiger, openSUSE 10.3, Win XP
I was on the Mac-Forums honor roll for September 2007
mac57 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Stumble this post
Reply With Quote
Old 06-07-2006, 06:28 PM   #4 (permalink)
rman

 
rman's Avatar
 
Member Since: Dec 24, 2002
Location: Los Angeles, California
Posts: 12,190
rman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud of
Mac Specs: 2 x 3.0GHz Quad-Core, 6GB OS X 10.5.7
Cool

You did press the delete key, in place of the word deletekey and not type deletekey. I should have made it more clear.
__________________
Life isn't about waiting for the storm to pass, It's about learning to dance in the rain!
rman is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Stumble this post
Reply With Quote
Old 06-07-2006, 06:49 PM   #5 (permalink)
mac57

 
mac57's Avatar
 
Member Since: Apr 29, 2006
Location: St. Somewhere
Posts: 4,529
mac57 has a brilliant futuremac57 has a brilliant futuremac57 has a brilliant futuremac57 has a brilliant futuremac57 has a brilliant futuremac57 has a brilliant futuremac57 has a brilliant futuremac57 has a brilliant futuremac57 has a brilliant futuremac57 has a brilliant futuremac57 has a brilliant future
Mac Specs: Mac Pro, 3.2 GHz 8 Core, 8 GB RAM, 2*750 GB Disk, nVidia 8800 GT
Well not exactly rman. In the "right out of the box" configuration (Apple's X11 as it came, I haven't mod'd Xresources, Xmodmap, etc.), when I press the Delete key I get some form of escape sequence that puts a few characters of jibberish in the screen. Starting from there, if I type "stty erase <press Delete key>" and try using the Delete key (desired behaviour is that it deletes the key under the cursor, not the one to the left of the cursor, like Backspace does) I still get jibberish.

I did eventually modify this such that the Delete key at least behaved like Backspace (trying out a suggestion I found on Google) by adding

xterm*.deleteIsDEL: true

to a .Xresources file. If I now restart Apple X11, the Delete key works like the Backspace key.

If I now follow your prescription above, pressing the Delete key where you say "deletekey" simply backspaces! I tried doing it "literally" (ctl-v, then Delete), the Delete kill still behaves like Backspace.

I have also tried "stty kill <press Delete key>" to no good end.

This is pretty frustrating. I have a perfectly good Delete key that will only Backspace. I am sure that some magic combination of Xresources, xmodmaps and sttys will do the job, but I am stuck for the prescription!
__________________
My Macs: Mac Pro, 3.2 GHz 8 Core, MacBook Pro, 2.2 GHz C2D
My iStuff: 32 GB iPhone 3G S, 30 GB iPod Video, 16 GB iPod Touch
My OS': Mac OS X Leopard, Mac OS X Tiger, openSUSE 10.3, Win XP
I was on the Mac-Forums honor roll for September 2007
mac57 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Stumble this post
Reply With Quote
Old 06-07-2006, 07:42 PM   #6 (permalink)
rman

 
rman's Avatar
 
Member Since: Dec 24, 2002
Location: Los Angeles, California
Posts: 12,190
rman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud of
Mac Specs: 2 x 3.0GHz Quad-Core, 6GB OS X 10.5.7
Cool

interesting, I would have to look farer. I have never used the delete key. Except for control-alt-del of course.
__________________
Life isn't about waiting for the storm to pass, It's about learning to dance in the rain!
rman is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Stumble this post
Reply With Quote
Old 06-14-2006, 02:41 PM   #7 (permalink)
mac57

 
mac57's Avatar
 
Member Since: Apr 29, 2006
Location: St. Somewhere
Posts: 4,529
mac57 has a brilliant futuremac57 has a brilliant futuremac57 has a brilliant futuremac57 has a brilliant futuremac57 has a brilliant futuremac57 has a brilliant futuremac57 has a brilliant futuremac57 has a brilliant futuremac57 has a brilliant futuremac57 has a brilliant futuremac57 has a brilliant future
Mac Specs: Mac Pro, 3.2 GHz 8 Core, 8 GB RAM, 2*750 GB Disk, nVidia 8800 GT
Solved it! Finally, here is how to make your Delete key act like a real Delete key, which is to say that it deletes the character currently under the cursor rather than doing a Rubout (delete the character to the left of the cursor) or worse still, insert a "~" into the line.

This solution is specific to the bash shell, and works for bash under both Apple's X11 xterm and Terminal.app (bash is the default shell in both cases).

Create a file in your home directory called .inputrc - Put the following single line into that file:

"\e[3~": delete-char

Restart Terminal.app or create a new xterm if using X11. Thats it! I have tested it and it works like champ. bash apparently reads this file every time it starts.

You can read LOTS more about this problem and related problems by Googling the phrase "bash delete key". Apparently this is a VERY common issue.
__________________
My Macs: Mac Pro, 3.2 GHz 8 Core, MacBook Pro, 2.2 GHz C2D
My iStuff: 32 GB iPhone 3G S, 30 GB iPod Video, 16 GB iPod Touch
My OS': Mac OS X Leopard, Mac OS X Tiger, openSUSE 10.3, Win XP
I was on the Mac-Forums honor roll for September 2007
mac57 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Stumble this post
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Why won't my animated gifs work on Macs? Kalitechnis Web Design and Hosting 21 05-07-2008 10:18 AM
Delete key not emulating right in ssh'd terminal n0r1 OS X - Applications and Games 2 03-13-2005 07:55 PM
Upgrade to 10.3.8/Eject Button Doesnt Work Fix MactotheMax OS X - Operating System 0 02-18-2005 02:58 PM
end key? jcart OS X - Operating System 0 01-08-2005 12:31 PM
space key does not work plutonito Other Hardware and Peripherals 7 09-15-2004 04:57 PM

 
 
 
     
Home Calendar Get New
     

Copyright ©2001-2009 Mac-Forums.com. All Rights Reserved. A division of iNET Interactive.

Other iNET Interactive Sites: Web Hosting Talk | Swish Talk | Hosting Catalog.com| Dev Papers| Deleted Domains| Hot Scripts

Powered by vBulletin
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.