utoddl
unread,Aug 2, 2011, 11:07:46 AM8/2/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
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.