Note that there are some explanatory texts on larger screens.

plurals
  1. POKeys not being interpreted by ncurses
    primarykey
    data
    text
    <p>I have a curses based application (<a href="http://wordgrinder.sf.net" rel="nofollow">WordGrinder</a>). I've just had a bug report from a user saying that some keys aren't working properly on his keyboard. On investigation, he's right.</p> <p>The keys in question are SHIFT+cursor keys and some of the keypad navigation keys, such as END. Investigating what's going on, it seems that curses is not sending me events for these keys. In the case of SHIFT+cursor keys, I'm not getting anything at all, and for END I'm getting a raw escape sequence.</p> <p>This surprises me. All the other keys are getting interpreted and translated correctly into keysyms. I'd <em>expect</em> to be getting <code>KEY_SLEFT</code> and <code>KEY_END</code>. Why aren't I?</p> <p>I've looked at some other applications where these keys work but don't spot anything obvious that I'm doing wrong; and applications like nano do really evil things like handle their own escape key parsing anyway, so I don't know if they're a good candidate for source code.</p> <p>I'm initialising ncurses as follows:</p> <pre><code>initscr(); raw(); noecho(); meta(NULL, TRUE); nonl(); idlok(stdscr, TRUE); idcok(stdscr, TRUE); scrollok(stdscr, FALSE); intrflush(stdscr, FALSE); keypad(stdscr, TRUE); </code></pre> <p>I'm using gnome-terminal as the terminal emulator, and xterm as the terminal type. Locale is UTF-8 and I've got the ncursesw variant of the library.</p> <p>Any ideas?</p> <p><b>Update:</b></p> <p>Well, many months later I try Wordgrinder with Gnome 3's gnome-terminal and discover that all these wacky keys generate valid ncurses keycodes. For example, SHIFT+LEFT now produces keycode 393. xterm produces exactly the same result. Unfortunately, CTRL+LEFT produces keycode 539, and the Curses documentation states clearly that valid keycodes are in the range KEY_MIN to KEY_MAX --- 257 to 511...</p> <p>So at least things work now, but how do these weird new keycodes work? Are they defined anywhere? They're certainly not in the headers.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload