NCurses和ESC,ALT键 [英] NCurses and ESC,ALT keys

查看:226
本文介绍了NCurses和ESC,ALT键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用 NCurses 时遇到问题...我需要处理所有键,例如 Esc Alt + F 等. 问题是代码相似...即:

I have a problem with NCurses... i need to handle all keys like Esc, Alt+F etc. Problem is that the codes are similar... i.e:

Esc -27

Alt + A -27 65

Alt+A - 27 65

例如,对于 Alt + [key] 组合有双重代码,与 Esc 密钥有何相似组合... 任何想法如何处理?

As an example there is double code for Alt+[key] combination what similar to Esc key... Any ideas how handle that?

推荐答案

解决方案:

  1. 使用noecho或超时模式
  2. 检查27( ALT ESC )代码...如果通过:
  3. 尝试读取其他代码
  4. 如果另一个代码是ERR,那么..您以其他方式具有 ESC 键,而您具有 ALT +另一个代码
  1. Use noecho or timeout mode
  2. Check for 27(ALT or ESC) code... if pass:
  3. try to read another code
  4. if another code is ERR then.. you have ESC key in other way you have ALT+another code

这篇关于NCurses和ESC,ALT键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆