Subject: home end keys do not work
To: None <netbsd-users@netbsd.org>
From: Lubos Vrbka <shnek@tiscali.cz>
List: netbsd-users
Date: 07/12/2004 19:13:07
hi guys,

some time ago i asked about my problem with 'home' and 'end' key 
behaviour (but with only one response stating that it works) - so i'm 
trying again... with more details now.

these keys do not work neither on terminal nor in xterm (aterm). this is 
sometimes very annoying (for example when editing long command line)... 
they just produce tilde character on the command line.

i'm using ksh, but i observed similar behaviour with csh, too (but there 
home produces ^[[1~ end produces ^[[4~)

system is i386 with quite old -current (1.6zk or something like that). 
below, i attach my config files - there might be something that i'm 
missing...

these 2 keys (with some others that are not so critical for me - f1 for 
example) do not also work in midnight commander.

could anyone please help me to track down the problem? where should i look?

tia, kind regards,
lubos

====================================================================

.profile
========
# all settings are read from .kshrc file
ENV=$HOME/.kshrc

.kshrc
======
export 
PATH=${PATH}:${HOME}:${HOME}/bin:.:/usr/pkg/java/sun-1.3.1/bin:${HOME}/data/office
export JAVA_HOME=/usr/pkg/java/sun-1.3.1

# to distinguish between normal logins and scp connections that
# don't allocate a tty
test -t 0 || return

stty erase ^?

set -o emacs
umask 022

alias mtv="plotmtv -colorps -nodate"
alias getmail="fetchmail -k"

eps2pdf ()
{
   for arg;
   do
     echo "converting $arg => pdf";
     epstopdf $arg
   done
}

# some special modifications based on bjan's suggestions (netbsd-help)
# replacing home directory (/home/xxxxx) with ~
homesubst () {
         local s

         if [ "$1" != "${1##/usr/home/$USER}" ]; then
                 s=\~${1##/usr/home/$USER}
         elif [ "$1" != "${1##/home/$USER}" ]; then
                 s=\~${1##/home/$USER}
         else
                 s=$1
         fi
         echo $s
}

# shortening long directory lists in prompt
promptpwd () {
         local s, n=0

         s=`homesubst $PWD`

         while [ ${#s} -gt 20 ]; do
                 s="${s#*/}"
                 let n++
                 [ $n -gt 8 ] && break
         done
         if [ $n -ne 0 ]; then
                 s="/<$n>/$s"
                 # or if you prefer...:
                 # s=".../$s"
         fi

         # byebye little string
         echo $s
}

set -o trackall
set +o posix
set -o braceexpand

# The gentle art of building PS1...
a=""   # non-printing char
r="
"    # <cr>
e=""  # <esc>
b="$a$e[1m$a"   # start bold
n="$a$e[m$a"    # normalize
PS1="$a$r"      # see ksh(1)

case $TERM in
         screen) PS1="$PS1$a${e}k$e\\$a" ;; # see screen(1)
esac

#PS1="$PS1[$b`hostname`$n] $b"'`promptpwd`'"$n \$ "
PS1="$PS1 $b"'`promptpwd`'"$n \$ "
unset -v a r e b n

-- 
Lubos
_@_"