LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   *BSD (http://www.linuxquestions.org/questions/%2Absd-17/)
-   -   OpenBSD 3.8 Home/End Keys Misbehaving (http://www.linuxquestions.org/questions/%2Absd-17/openbsd-3-8-home-end-keys-misbehaving-418110/)

taylor_venable 02-21-2006 03:47 PM

OpenBSD 3.8 Home/End Keys Misbehaving
 
I know this question has been asked a million times, but despite my best attempts to squash it, the problem persists. I just installed OpenBSD 3.8 on a server and every press of Home or End results in "~". I've tried using the .inputrc file with these lines:

"\e[3~": delete-char
"\e[1~": beginning-of-line
"\e[4~": end-of-line

But I still get (mostly) no love; delete now works, but Home and End still do not. I'm using Bash 3.0.16p1, but the issue also manifests when using the default ksh that comes with OpenBSD 3.8. Thanks very much for any advice you can come up with (aside from just using C-a and C-e, of course). :)

Other details: keyboard is PS/2 104 key EN_US map; console is vt220; anything else needed, please ask.

Worksman 08-20-2006 08:43 AM

I have the same problem. I haven't found a fix but it is strange it doesn't happen in xterm just in rxvt and the cli.
I now know rxvt uses readline so the lines you put in inputrc might work for me, will test.
But what does xterm use?

Randux 08-28-2006 03:06 PM

Taylor checkout bsdforums.org if you haven't already. I had some questions when I installed 3.8 and everything works fine now (although I "upgraded" to 3.9 when it came out.)

Sorry I can't remember exactly what to look for but there aren't many posts in the openbsd forum, you should be able to find it. If not let me know and I'll see what I can find.

Worksman 08-28-2006 03:53 PM

Well some things I discovered. I changed my /etc/terminfo. Slackware has /etc/{terminfo;terminfo-BSD;terminfo-Linux}. Using the BSD one made one difference: both End and Home now produce ~. My old terminfo and the terminfo-Linux only affect the End key (produces ~).

Randux 08-28-2006 03:57 PM

Hi Workman,

On Slackware I also use a keymap for emacs from /usr/share/kbd/keymaps.

Did you mean termcap or terminfo?

Worksman 08-28-2006 04:11 PM

Why do we need to use different keymaps for Slackware to work??? :'( Why can't everything use damn English if my locale is English!?
How do you set this keymap separate for each app?
I mean termcap. Even Eterm uses it :S
You use Slackware too, right? What's your status with all this trouble? So far, I haven't found any fix.

Randux 08-28-2006 04:27 PM

Quote:

Originally Posted by Worksman
Why do we need to use different keymaps for Slackware to work??? :'( Why can't everything use damn English if my locale is English!?
How do you set this keymap separate for each app?
I mean termcap. Even Eterm uses it :S
You use Slackware too, right? What's your status with all this trouble? So far, I haven't found any fix.

I only had a problem because I wanted to use emacs from console. When I used the emacs keymap (and maybe I did something else but it was almost a year ago and I can't remember :() then it fixed all my keyboard problems.

I set the keymap globally in startup by making a symlink from /etc/rc.d/rc.keymap to the emacs keymap in the path i mentioned in the last post.

I don't see any termcap in my /etc but I only have terminfo.

Doing this and what advice I got in bsdforums.org fixed my problems in Slackware and OpenBSD.

Maybe search here for the woodsman's posts because I think his site was the one where I got the information and I didn't use it exactly but I figured out what I needed to do from it. I'm sorry I can't remember. There will be a thread with us discussing something similar, I hope it will also fix your problem.

edit: here is the link I was talking about:
http://www.linuxquestions.org/questi...keyboard+emacs

I am still checking to see if there's any other info.

Randux 08-28-2006 06:35 PM

Maybe I misunderstood you guys. I did get Home to work in console (I don't use it, it just worked after the other changes I made) but End doesn't work. I really don't care since bash shell uses either emacs or vi key commands- to get to the end of the line you do control e in bash (default) and since I use emacs I'm used to doing it this way and for me it's actually faster. If you prefer vi you can set bash to use vi-style control keys.

I wish I could paste text in this forum using control Y but when I do that nothing happens :p

I guess next time I should get coffee before trying to answer. Why do we need different keymaps? Because there are many different keyboard types. And not all have keys in the same place on the keyboard. Try writing an ncurses app and you can see the wierd key codes you get in different terminals and console for the same key :(

Worksman 08-28-2006 10:21 PM

Quote:

Originally Posted by Randux
Maybe I misunderstood you guys. I did get Home to work in console (I don't use it, it just worked after the other changes I made) but End doesn't work. I really don't care since bash shell uses either emacs or vi key commands- to get to the end of the line you do control e in bash (default) and since I use emacs I'm used to doing it this way and for me it's actually faster. If you prefer vi you can set bash to use vi-style control keys.

I wish I could paste text in this forum using control Y but when I do that nothing happens :p

I guess next time I should get coffee before trying to answer. Why do we need different keymaps? Because there are many different keyboard types. And not all have keys in the same place on the keyboard. Try writing an ncurses app and you can see the wierd key codes you get in different terminals and console for the same key :(

I meant why can't one setting just set them all. If I live in the USA (which I don't but I prefer my sytem to "thinks" it's in the USA), them why doesn't every app just use a en_US standard keyboard map with Home and End working. But that not the real problem, the problem is that vi (elvis on Slackware) doesn't run properly: text won't delete, cursor moves blocks of text with it while editing and in fact that text that it "carries around" ain't there (as you can see if you save the file and cat it).
Argh, I wish Slackware was as easy as Gentoo! Maybe I should go back to Gentoo... or Arch! Dammit!

Sorry for my cursing but I can't stand it anymore! I'm using Slackware cause it's the most stable (not so patched) distro there is and I care for stability and software that works as the creators intended(vanilla).

Worksman 08-28-2006 10:25 PM

Quote:

Originally Posted by Randux
I only had a problem because I wanted to use emacs from console. When I used the emacs keymap (and maybe I did something else but it was almost a year ago and I can't remember :() then it fixed all my keyboard problems.

I set the keymap globally in startup by making a symlink from /etc/rc.d/rc.keymap to the emacs keymap in the path i mentioned in the last post.

I don't see any termcap in my /etc but I only have terminfo.

Doing this and what advice I got in bsdforums.org fixed my problems in Slackware and OpenBSD.

Maybe search here for the woodsman's posts because I think his site was the one where I got the information and I didn't use it exactly but I figured out what I needed to do from it. I'm sorry I can't remember. There will be a thread with us discussing something similar, I hope it will also fix your problem.

edit: here is the link I was talking about:
http://www.linuxquestions.org/questi...keyboard+emacs

I am still checking to see if there's any other info.

Yes I heard termcap was absolete and terminfo is now used. I wonder why I still have it? I use Slackware -current. Will check that... can I see the terminfo file?

Does this thing you did for Emacs solve all console problems including vi/vim/jed?

Randux 08-29-2006 07:58 AM

Quote:

Originally Posted by Worksman
I meant why can't one setting just set them all. If I live in the USA (which I don't but I prefer my sytem to "thinks" it's in the USA), them why doesn't every app just use a en_US standard keyboard map with Home and End working. But that not the real problem, the problem is that vi (elvis on Slackware) doesn't run properly: text won't delete, cursor moves blocks of text with it while editing and in fact that text that it "carries around" ain't there (as you can see if you save the file and cat it).
Argh, I wish Slackware was as easy as Gentoo! Maybe I should go back to Gentoo... or Arch! Dammit!

Sorry for my cursing but I can't stand it anymore! I'm using Slackware cause it's the most stable (not so patched) distro there is and I care for stability and software that works as the creators intended(vanilla).

It's not that simple and it's not a Slackware problem, we also had this problem on OpenBSD. There are many different keyboard layouts in the world (Home and End are not always in the same place on every keyboard) and the default just doesn't work the way we want. Ok, so we can change it. Don't become upset for nothing. Soon you will have this fixed.

First take a look at /etc/inputrc like Taylor mentioned and I mentioned in the post I linked. I took almost everything out of mine since it all looked bad. Of course cp inputrc inputrc.bkup or something before you change it so you can recover if you mess up.
Log off, log on, test. This may fix all your problems (even though it didn't for us :p)

Next look through that list of keyboards I mentioned earlier in the thread and then just try a few keyboard layouts. You don't have to reboot to make this work, just set the keyboard layout as root. Here's my script:

Code:

#!/bin/sh
# Load the keyboard map. More maps are in /usr/share/kbd/keymaps.
#
if [ -x /usr/bin/loadkeys ]; then
 /usr/bin/loadkeys emacs.map.gz
fi

when you decide which keymap you want, change this script and save it as /etc/rc.d/rc.keymap with chmod +x (as root)

To find out which keymap you want, when you are testing open a root terminal and do:

Code:

/usr/bin/loadkeys nameofyourkeymap.gz
after that log off and log back in and see if it worked.

Do man bash or info bash and look into how to set the environment to vi-style commands if you don't like emacs-style. I didn't have to do this because emacs style is the default.

I don't know what I was looking at when I answered about the termcap/terminfo. On my system there are several termcaps, no terminfo. I can't tell if I modified any of them. Sorry and I will never write about this topic again :p

I don't use any of the vi editors so I can't answer your question. But my keyboard now works like I want for emacs in x terminals and console.

Worksman 08-29-2006 01:26 PM

What's the difference, vi-style commands and emacs-style commands?
Even if you don't use vi, it is a required package for Slackware.
I never (ever) even looked at what Emacs is or looks like. I just go for the simplest thing, a good programming editor and that's it. (I know emacs is more than an editor).
Thank you for your help. I will read your posts soon, cause I'm too busy right now.

Randux 08-30-2006 06:46 AM

Quote:

Originally Posted by Worksman
What's the difference, vi-style commands and emacs-style commands?
Even if you don't use vi, it is a required package for Slackware.
I never (ever) even looked at what Emacs is or looks like. I just go for the simplest thing, a good programming editor and that's it. (I know emacs is more than an editor).
Thank you for your help. I will read your posts soon, cause I'm too busy right now.

Vi is certainly not a required package for Slackware. Nothing is required in Slackware except the kernel and a few utilities :p

What's the difference between vi-style commands and Emacs commands? I don't know, because I don't know Vi. When I want to go to the end of a line in Emacs I press C-e. When I want to go to the beginning of a line, I press C-a. When I want to go to the beginning of a file I press Alt-LeftShift-<

The point is that bash is set up for guys who use Emacs or vi so that whatever keys you use in your editor you can use on the command line (within reason). So I don't have problems with home and end keys because I don't use them.

Worksman 08-30-2006 11:34 AM

Quote:

Originally Posted by Randux
Vi is certainly not a required package for Slackware. Nothing is required in Slackware except the kernel and a few utilities :p

What's the difference between vi-style commands and Emacs commands? I don't know, because I don't know Vi. When I want to go to the end of a line in Emacs I press C-e. When I want to go to the beginning of a line, I press C-a. When I want to go to the beginning of a file I press Alt-LeftShift-<

The point is that bash is set up for guys who use Emacs or vi so that whatever keys you use in your editor you can use on the command line (within reason). So I don't have problems with home and end keys because I don't use them.

Strange cause, if I remember correctly, you can't compile the kernel without vi... or do patching. IIRC, when I removed vi (I just wanted vim) I got errors on kernel compilations (and other) about vi not being there. So I guess vi is needed.

Randux 08-31-2006 06:36 AM

I haven't compiled a kernel on Slackware but I have installed several Slackware machines without vi and they all work :p


All times are GMT -5. The time now is 09:03 AM.