Why iTerm sends \e[A for up-cursor, while termcap & terminfo give different values?
Thanks for filing an issue! Please answer the questions below so I can help you.
- iTerm2 version: 3.2.6beta2
- OS version: 10.13.4 (17E202)
- Attach com.googlecode.iterm2.plist here (drag-drop from finder into this window)
Detailed steps to reproduce the problem:
-
cat -v[Enter]
-
[Up-Cursor] Output: ^[[A
-
[Ctrl-C]
-
zsh[Enter]
-
print -rl -- ku:${(q)termcap[ku]} cuu1:${(q)terminfo[cuu1]} kcuu1:${(q)terminfo[kcuu1]} kd:${(q)termcap[kd]} cud1:${(q)terminfo[cud1]} kcud1:${(q)terminfo[kcud1]}[Enter]
Output:
ku:$'\033'OA
cuu1:$'\033'\[A
kcuu1:$'\033'OA
kd:$'\033'OB
cud1:$'\n'
kcud1:$'\033'OB
What happened: cat -v shows that iTerm emits \e[A. Zsh has access to terminfo & termcap databases. The print-line shows, that all codes except for cuu1
say that \eOA should be emitted. Value of analogous cud1
for Cursor-Down says clearly that a terminal should follow the k-prefixed terminfo fields (kcuu1
& kcud1
), because cud1
has the AFAIK internal-operation code, the new-line \n.
What should have happened: cat -v should print ^[OA, i.e. \eOA or \033OA (\033 is the escape \e, ^[) when Cursor-Up is pressed.