Go Back   DaemonForums > Miscellaneous > General software and network

General software and network General OS-independent software and network questions, X11, MTA, routing, etc.

Thread Tools Display Modes
  #1   (View Single Post)  
Old 23rd August 2008
graudeejs's Avatar
graudeejs graudeejs is offline
Real Name: Aldis Berjoza
ISO Quartermaster
Join Date: Jul 2008
Location: Riga, Latvia
Posts: 589
Default xterm End key

IDK if it's only FreeBSD problem or other OS's got it as well.

When i enter editor in xterm (i use le, but same thing applies to many others, if not all of them, as well), when i'm at beginning of line and hit End key, nothing happens. I would like to fix this if it's possible.

How can i fix that, what info do you need?

p.s. End key works in gui editors

I use fully customized environment, no gnome, no kde etc...

$ uname -a
FreeBSD killasmurf.HomePC 7.0-RELEASE-p3 FreeBSD 7.0-RELEASE-p3 #1: Sat Aug  2 00:45:09 EEST 2008     killasmurf@killasmurf.HomePC:/usr/obj/usr/src/sys/killabsd  i386
$ xterm -v

Last edited by graudeejs; 23rd August 2008 at 04:02 PM.
Reply With Quote
  #2   (View Single Post)  
Old 24th August 2008
IdOp's Avatar
IdOp IdOp is offline
Too dumb for a smartphone
Join Date: May 2008
Location: twisting on the daemon's fork(2)
Posts: 999

This won't be a perfect answer to your question, but maybe it can get you started. In this kind of problem, the first thing I would do is go into the xterm shell and type
# cat > /dev/null
Then hit the key you're interested in, in this case End (you can also try Keypad-End), and see what you get. To break out of the cat use Ctrl-D.

For most keys this will show you what you're getting in the xterm when you hit the key. In my case with End I see:
(This is just how I've set the key up, you may see something different.) The first ^[ really indicates Escape, it's a sequence of Escape [ 4 ~ .

Then you have to get your editor to use this. Never used le, but for emacs I put in my ~/.emacs file:
(global-set-key "\e[4~" 'move-to-window-end)    ; for xterm
Here "move-to-window-end" is the function I want on that key (it's a function I defined elsewhere).

The other question is where does the ^[[4~ come from? You can set this up in your ~/.Xresources file. Mine includes the following:
*VT100.Translations: #override \
              !<Key>BackSpace:    string(0x7F) \n\
              !<Key>KP_Begin:     string(0x1b) string("[G") \n\
              !<Key>Home:         string(0x1b) string("[1~") \n\
              !<Key>KP_Home:      string(0x1b) string("[1~") \n\
              <Key>Insert:        string(0x1b) string("[2~") \n\
              !<Key>KP_Insert:    string(0x1b) string("[2~") \n\
              <Key>Delete:        string(0x1b) string("[3~") \n\
              !<Key>KP_Delete:    string(0x1b) string("[3~") \n\
              !<Key>End:          string(0x1b) string("[4~") \n\
              !<Key>KP_End:       string(0x1b) string("[4~") \n\
              c<Key>Home:         string(0x1b) string("[35~") \n\
              c<Key>KP_Home:      string(0x1b) string("[35~") \n\
  etc. etc.
You shouldn't copy this verbatim, it's just an example, but you can see where the ^[[4~ comes from. In the .Xresources file "string(0x1b)" represents Escape character.

Hope this helps a bit.

Last edited by IdOp; 24th August 2008 at 04:59 PM. Reason: glitches
Reply With Quote

end key, key bindings, xterm

Thread Tools
Display Modes

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
xterm color does not behave properly. pieterverberne OpenBSD General 2 19th August 2009 05:17 PM
xterm + bash: Make <DEL> delete char under cursor taylor_venable OpenBSD General 7 13th December 2008 11:53 PM
How add additional features on xterm ( Xfce ) ? aleunix OpenBSD Packages and Ports 4 5th June 2008 02:18 PM

All times are GMT. The time now is 08:37 AM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick