简体   繁体   中英

ncurses most portable keys to use

I use ncurs for an application which dispays data to users in real-time.

the user can do string input of normal char type. eg az, AZ 0-9 etc. So I cannot use those keys to do other things like change windows or quit.

Now it seemed like a good idea to use the F-keys but some KEY_F(x) are not recognized on some terminal emulators.

What keys are the best to use and offer the best portability for a ncurses application?

Personally I favour using one of the modifier keys with letters, it is something of a defacto standard in ncurses apps to use the letter keys with control held down for special functions.

This approach instantly gives you 26 * 2 + 9 hotkey combos for special functions, plenty for most apps.

Please take a look at gnu nano for a great example of this. Remember these may be hard to remember for new users so try and provide some kind of tool-tips or a easy to remember help button like escape or ctrl-h.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM