Why is terminfo[kcuu1] = '\EOA'?

前端 未结 1 1283
故里飘歌
故里飘歌 2021-01-20 11:17

From what I can tell reading terminfo(5), kcuu1 should be the sequence that the terminal sends when the up arrow is pressed. I have never, ever seen that be any

1条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-20 11:55

    Arrow and other special keys (terminfo refers to them as "keypad") send different codes depending on whether the terminal is in "application mode" or not. An application that wants to make use of the various k* keys is supposed to output smkx first (and rmkx at the end to restore the old behavior).

    You can try Ctrl+V Up in vi (or a similar terminal application) to see that Up does indeed send \EOA there.

    See these links for more details:

    • Terminfo smkx and Application Cursor Keys vs Application keypad
    • http://invisible-island.net/xterm/xterm.faq.html#xterm_arrows

    0 讨论(0)
提交回复
热议问题