Determining escape sequences for cursor keys canonically

耗尽温柔 提交于 2019-12-02 06:55:38

What the cursor keys send depends on the keyboard mode.

tput reports their application mode value but by default, the keyboard is in standard mode.

The DEKCKM command can be used to just change they cursor key behavior, example:

printf "\033[?1h"

or you can use the smkx command which set the keyboard to application mode:

tput smkx

Reset with:

printf "\033[?1l"

or

tput rmkx

I think what you needed is tput cud1 (without the k). You can also get a list of tput commands here:

http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/x405.html

Also you can store those sequences on a variable through VAR=$(tput xyz).

And everything is in man terminfo. Online: http://www.manpagez.com/man/5/terminfo/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!