Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: $terminfo for up and down arow



Ivan Brkanac wrote:
> as from zsh 5.0.3 and till 5.0.5 there is some change in up and down
> arrow as reported by "$terminfo[kcuu1]" and "$terminfo[kcud1]" it
> reports ^[OB and ^[OA on os x 10.9.1 and zsh from homebrew corect
> sequence is '^[[B' and '^[[A'.

The correct values largely depend on the value of $TERM. For example,
with $TERM := screen, the correct value is "^[OA".

What might be confusing you, is the fact that the values from $terminfo
are _only_ valid in "keyboard-transmit-mode". That's the mode you enter,
by issuing "smkx" and you leave by "rmkx" (see terminfo(5)).

Zsh's line editor (zle), does not do this by default, but it can by made
to do that, when it is active. One caveat to note is, that not all
terminals _have_ an explicit "smkx" mode (they just default to being in
"keyboard-transmit-mode" all the time), so you need to check for the
ability of the terminal before trying to use it:

zle-line-init () {
    (( ${+terminfo[smkx]} )) && echoti smkx
}
zle-line-finish () {
    (( ${+terminfo[rmkx]} )) && echoti rmkx
}

Regards, Frank



Messages sorted by: Reverse Date, Date, Thread, Author