Menu capturing ctrl + arrow key

46 views
Skip to first unread message

Jonathan Kingston

unread,
Oct 19, 2012, 8:02:40 PM10/19/12
to nicee...@googlegroups.com
I use ctrl + arrow key to load up the menus in ne all the time however pressing the same to hide the menu again prints out the character codes into the document like:
[1;5B[1;5A

Is there any direction you could give so I could compile ne not to do this?

Thanks
Jonathan

utoddl

unread,
Oct 19, 2012, 10:51:37 PM10/19/12
to nicee...@googlegroups.com
There's no standard way to tell a terminal that you had the Ctrl key pressed when you hit a cursor key. All that comes across the wire is a sequence of bytes. In this case, the sequence your terminal is creating in response to Ctrl-Up is an Esc character followed by a left bracket, the digit 1, a colon, the digit 5, then a capital A. Ctrl-Down is the same except it ends with a B instead of an A.

Ne is seeing the first escape character, and what follows doesn't match any defined sequence, so it takes the escape as a single character which brings up or cancels the menu. The rest of the characters come across as individual characters as well, and they end up in your document.

What you need to do is to define the sequence of bytes generated by these keystrokes, bind them to one of ne's virtual "keys", then bind that key to a command, in this case the "Escape" command. The way you do this is to create (or modify if it already exists) a ~/.ne/.keys file to contain the following lines:

# Ctrl-Up
SEQ  "\x1b[1;5A"  20

# Ctrl-Down
SEQ  "\x1b[1;5B"  20

# Ctrl-Right
SEQ  "\x1b[1;5C"  20

# Ctrl-Left
SEQ  "\x1b[1;5D"  20
KEY  20  Escape

The "SEQ" statements will map each of the escape sequences that your terminal generates for Ctrl-<cursor> combinations to ne's virtual key #20. The final "KEY" statement binds key 20 to the Escape command. (That's the command normally bound to the Esc key.) It essentially turns all your Ctrl-<cursor> keys into Escape commands, which bring up or cancel the menus.

If I understand what you're trying to do, this should solve your problem.
--
Todd

Sebastiano Vigna

unread,
Oct 20, 2012, 6:20:56 AM10/20/12
to nicee...@googlegroups.com
You actually can't do that--it works just by chance. Try ESC-ESC or F1...

Ciao,

seba

Jonathan Kingston

unread,
Oct 22, 2012, 9:47:19 PM10/22/12
to nicee...@googlegroups.com
That works perfectly thank you so much, this has irritated me for years. More often than not I just hit it when changing work spaces or muscle memory or something.
Reply all
Reply to author
Forward
0 new messages