Something worth noting here; I noticed that with ncurses_wgetch function keys are broken into multiple codes while ncurses_getch returns only one attributed code.

For example, with ncurses_wgetch pressing an up arrow results in three codes 27 91 65 (an ascii escape sequence). The problem is subsequent calls to ncurses_wgetch are required to acquire all three codes. Unfortunately, pressing an “A” key for example would result in only a single code of 65. This makes it hard to trap for both function keys and regular keys.

However, with ncurses_getch an up arrow results in a single attributed code of 259 or the “NCURSES_KEY_UP” key constant. An “A” key is still 65.