1

While I figured out that I can just use something like #define ctrl(x) ((x) & 0x1f)2 for most plain ASCII (non numerical or [obviously] symbol) characters, I was unable to find any info or documentation on how to capture CTRL + ARROW_KEYS or any other sane\logical combinations of CTRL + SHIFT + ch and so on...

The reason I care about this, is because I am trying to maintain a project called unicurses and while I'm trying to maintain this project I'm also making a prototype demo of a terminal based editor with it where I need to capture those kind of key combinations and so I was looking for some help (also I really don't care if the answer will be in c\c++, python or whatever, I'm just looking for a way of doing it)

Any Idea?

Giorgos Xou
  • 1,461
  • 1
  • 13
  • 32

1 Answers1

3

Try the "Input Test" in PDCurses' testcurs demo. You'll see there that CTRL + Up Arrow is returned as "CTL_UP". The full list of named keys is in curses.h. Some combinations can only be distinguished by their modifiers, as returned by PDC_get_key_modifiers().

I'm not sure how or whether you'd do it in ncurses.

In general, I recommend you avoid these exotic key combos.

William McBrine
  • 2,166
  • 11
  • 7