KeyCodes for CTRL + Arrow Keys?

53 views
Skip to first unread message

jason404

unread,
Aug 2, 2011, 5:32:20 AM8/2/11
to nicee...@googlegroups.com
What are these the keycodes for the CTRL + the Left and Right Arrow keys?

I am using XTerm emulation, and then I try using these key combinations, crazy stuff happens with the menus.

Even if I have to wait months or years for an answer, please reply if you know!

jason404

unread,
Aug 2, 2011, 5:52:01 AM8/2/11
to nicee...@googlegroups.com
Oh, I forgot to mention that I have these key combinations to "\e[1;5C" and "\e[1;5D" in my SSH client configuration, so that I can use them to go back and forward one work at a time in bash.

I would really like the same to happen in Ne.

utoddl

unread,
Aug 2, 2011, 11:07:46 AM8/2/11
to nicee...@googlegroups.com
The simple answer is, there aren't any keycodes for CTRL+Arrow Keys. At least, not in the terminal definitions I've looked at. There's no matching termcap capability that means "the user hit Ctrl+Left" for example.

Unfortunately, it would be a two step process. First you'd have to map the CTRL+Left and CTRL+Right sequences (which you've correctly identified above) to some key definition in terminfo, compile the new terminfo description using the tic program, then use that when you run your terminal. Then you'd have to set up a keys file for ne to map that key to the PrevWord and NextWord commands.

A simpler but just as ugly approach would be to hard-code the sequence directly into ne. Ugly, yes, but not hard at all. In fact, quite a few broken but common sequences are already hard-coded to compensate for the large number of bad terminal descriptions out there. You could add something like the following to the keys.c file:

   key_may_set("\x1b[1;5C",  NE_KEY_F(7)); /* Ctrl-Left acts like F7 */
   key_may_set("\x1b[1;5D",  NE_KEY_F(8)); /* Ctrl-Right acts like F8 */

This does something close to what you're trying to do, because by default F7 and F8 are mapped to the PW (PreviousWord) and NW (NextWord) commands.

It may just be easier to use F7 and F8. But, hey, it's Free Code; do whatever you like.

jason404

unread,
Aug 6, 2011, 12:21:29 PM8/6/11
to nicee...@googlegroups.com
Hi Todd.  Thanks a lot for your help.  I recompiled ne with the changes and it's working fine.  Just in case anybody else does this, you had the keys the wrong way around.

I have a way to go before I can understand why this is an ugly hack, and I don't know why this would not be included in the official release.  It's certainly a lot better than what I was doing before as a temporary workaround, which was mapping the keys directly to F7 and F8 in the terminal emulator, and then doing some horrible stuff in .inputrc to work around that.

Cheers
Reply all
Reply to author
Forward
0 new messages