From: Santiago Romero < >
Newsgroups: es.comp.os.linux,esp.comp.so.linux
Subject: Solucionado inicio/fin y tecla supr en las X (script).
Organization: Compiler Software

COMO SOLUCIONAR EL PROBLEMA DE INICIO/FIN/BACKSPACE en X:
=========================================================

 Buenas. Gracias a un script que tenia en el disco duro,
supongo que bajado de alguna web, de Arturo Valdes segun
pone en el mismo, y ejecutandolo como root, he conseguido
arreglar el problema del SUPR en las X.

 Aqui va el script. Debajo de él está mi .inputrc que
soluciona el problema de INICIO y FIN en las Xterm y
en las rxvt, así como la manera de solucionarlo en el joe.
Espero que asi podamos tener una solución definitiva al
asunto. Las gracias, para HueBond, Pablo Saratxaga y
Arturo Valdes, por la información, el script, etc.:

 Fichero BACKSPACE.SH (ejecutar como ./backspace.sh tras
darle permisos de ejecución, chmod +x, y como root).
------------------------------------------------------------
#!/bin/sh

# 
# Ejecutarlo como "sh bakspace.sh"
#
# Copiado por Arturo Valdes de un articulo de vicen camacho
#

if [ -f /etc/X11/xdm/Xresources ]
then
echo "Actualizando /etc/X11/xdm/Xresources .."
cat >> /etc/X11/xdm/Xresources <<'\EOF'
*ttymodes: erase ^H kill ^U intr ^C quit ^\ eof ^D susp ^Z start ^Q stop
^S eol ^@
*VT100*translations: #override \
                <Key>Delete:    string(0x1b) string("[3~")\n\
                <Key>Home:      string(0x1b) string("[1~")\n\
                <Key>End:       string(0x1b) string("[4~")
!  To make Backspace delete-previous-character and Delete
!  delete-next-character in Motif applications generally ...
!
*XmText.translations:      #override \n\
                  ~a <Key>osfBackSpace: delete-previous-character()\n\
                  ~a <Key>osfDelete: delete-next-character() \n\
                  ~a <Key>BackSpace: delete-previous-character() \n\
                  ~a <Key>Delete: delete-next-character() \n\
                  a <Key>osfDelete: delete-previous-word() \n\
                  c <Key>d: delete-next-character() \n\
                  a <Key>d: delete-next-word() \n\
                  c <Key>a: beginning-of-line() \n\
                  c <Key>e: end-of-line() \n\
                  c <Key>k: delete-to-end-of-line() \n\
                  a <Key>Left: backward-word() \n\
                  a <Key>Right: forward-word()
*XmTextField.translations:      #override \n\
                  ~a <Key>osfBackSpace: delete-previous-character()\n\
                  ~a <Key>osfDelete: delete-next-character() \n\
                  ~a <Key>BackSpace: delete-previous-character() \n\
                  ~a <Key>Delete: delete-next-character() \n\
                  a <Key>osfDelete: delete-previous-word() \n\
                  c <Key>d: delete-next-character() \n\
                  a <Key>d: delete-next-word() \n\
                  c <Key>a: beginning-of-line() \n\
                  c <Key>e: end-of-line() \n\
                  c <Key>k: delete-to-end-of-line() \n\
                  a <Key>Left: backward-word() \n\
                  a <Key>Right: forward-word()
\EOF
fi

if [ -f /etc/profile ]
then

echo "Actualizando /etc/profile .. "
cat >> /etc/profile <<'\EOF'
  if tty --quiet ; then
    stty erase '^H'
  fi

  if [ "$TERM" = "xterm" -o "$TERM" = "xterm-color" ]; then
     echo -en '\033[36h'
  fi
\EOF
fi

if [ -f /etc/rc.d/rc.local ]
then
echo "actualizando  /etc/rc.d/rc.local  ..."
cat >> /etc/rc.d/rc.local <<'\EOF'
  echo "keycode 14 = BackSpace" | loadkeys
\EOF
fi
------------------------------------------------------------

 Despues, el tema del inicio/fin.
Os pego mi .inputrc, sacado de la SUSE, y que he ido modificando
hasta que ha funcionado :-) Ponerlo en vuestro home y probad
suerte en las Xterm. Creo que tambien podeis ponerlo en /etc.

-------------------------------------------------------------
###########################################################
## /etc/inputrc
##
## Attempt to put different TERMs together in one readline
## init file. Copyright 1997 S.u.S.E. GmbH Fuerth, Germany.
##
## Author: Werner Fink,  
##
############################################################
set bell-style none
set meta-flag on
set output-meta on
set convert-meta off
#
# VI line editing
#
$if mode=vi
set editing-mode vi
set keymap vi
$endif
#
# Common standard keypad and cursor
#
"\e[2~":        yank
"\e[3~":        delete-char
"\e[5~":        previous-history
"\e[6~":        next-history
"\e[C":         forward-char
"\e[D":         backward-char
"\e[A":         previous-history
"\e[B":         next-history
"\e[7~":        beginning-of-line
"\e[8~":        end-of-line
"\e[H":  beginning-of-line
"\e[F":  end-of-line 
$if term=xterm
"\e[E":         re-read-init-file
$else
"\e[G":         re-read-init-file
$endif
#
# Avoid network problems
#   ... \177 (ASCII-DEL) and \010 (ASCII-BS)
#       do `backward-delete-char'
# Note: `delete-char' is maped to \033[3~
#       Therefore xterm's responce on pressing
#       key Delete or KP-Delete should be
#       \033[3~ ... NOT \177
#
"\C-?":         backward-delete-char
"\C-H":         backward-delete-char
#
# Home and End
#
#$if term=xterm
#
# Normal keypad and cursor of xterm
#
#"\e[1~":       history-search-backward
#"\e[4~":       set-mark
"\e[H":         beginning-of-line
"\e[F":         end-of-line
# Home and End of application keypad and cursor of xterm
"\eOH":         beginning-of-line
"\eOF":         end-of-line
#$else
#
# TERM=linux or console
#
"\e[1~":        beginning-of-line
"\e[4~":        end-of-line
#$endif
#
# Application keypad and cursor of xterm
#
"\eOD":         backward-char
"\eOC":         forward-char
"\eOA":         previous-history
"\eOB":         next-history
"\eOE":         re-read-init-file
# DEC keyboard KP_F1 - KP_F4
"\eOP":         prefix-meta
"\eOQ":         undo
"\eOR":         ""  
"\eOS":         kill-line
#
# Function keys F1 - F12
#
# On console the first five function keys
#
"\e[[A":        "startx"
"\e[[B":        "logout"
"\e[[C":        ""
"\e[[D":        ""
"\e[[E":        ""
#
$if term=xterm
#
# Application keypad and cursor of xterm
# with NumLock ON
#
# Operators
"\eOo":         "/"
"\eOj":         "*"
"\eOm":         "-"
"\eOk":         "+"
"\eOl":         "+"
"\eOM":         accept-line
# Colon and dot
# "\eOl":               ","
"\eOn":         "."
# Numbers
"\eOp":         "0"
"\eOq":         "1"
"\eOr":         "2"
"\eOs":         "3"
"\eOt":         "4"
"\eOu":         "5"
"\eOv":         "6"
"\eOw":         "7"
"\eOx":         "8"
"\eOy":         "9"
$endif
#
#  EMACS line editing
#
$if mode=emacs
#
# ... xterm application cursor
#
$if term=xterm
"\e\eOD":       backward-word
"\e\eOC":       forward-word
"\e\eOA":       up-history
"\e\eOB":       down-history
"\C-\eOD":      backward-char
"\C-\eOC":      forward-char
"\C-\eOA":      up-history
"\C-\eOB":      down-history
$endif
#
# Standard cursor
#
"\e\e[D":       backward-word
"\e\e[C":       forward-word
"\e\e[A":       up-history
"\e\e[B":       down-history
"\C-\e[D":      backward-char
"\C-\e[C":      forward-char
"\C-\e[A":      up-history
"\C-\e[B":      down-history
$endif
#
# end
#
-------------------------------------------------------------

 En teoria ahora haceis un logout y volveis a entrar (o
cerrais la xterm y abris otra) y ya os deberia ir inicio y
fin. Ahora para arreglar el problema en el joe, editais el
joerc o, en mi caso, el /usr/lib/joe/joerc y buscais
(ctrl+k+f) la cadena bol (beggining of line), que pondrá
esto:

bol             .kh             Goto beginning of line

 Pues a&ntiled;adis (debajo de esta) lo siguiente:

bol             ^[ [ H
bol             ^[ [ 1 ~

 El espacio entre bol y el ^ son 2 tabuladores. El simbolo
^ se consigue pulsando shift+la teclilla del ^ y pulsando
luego espacio. El simbolo ~ es altgr+4.

 Luego buscais eol (end of line) en el mismo fichero, un
poco mas abajo, y lo dejais asi:

eol             .kH             Go to end of line
eol             ^[ [ 4 ~
eol             ^[ [ F
eol             ^E
eol             ^[ O F

 Yo con esto he conseguido que inicio/fin vayan perfectamente
en la consola y que en las xterm tambien, tanto las del keypad
como las de sobre los cursores...

 salu2!

 NOTA: Para las nxterm:  usar tambien:     \e\C-@

--
 NOTICIA DE ULTIMA HORA: Programador encontrado muerto
en la ducha agarrando una botella de champú que decía:
"Lavar, aclarar, repetir".

--------------------------------------------------------
 Santiago Romero  AKA NoP/Compiler /  
 Electronics Engineering and Telecommunications Student
            http://members.xoom.com/sromero
             http://www.arrakis.es/~sromero
--------------------------------------------------------
 POWERED BY - Linux RedHat 5.1  -  Reg. User #74.821


Santiago Romero

Volver a la página de linux.