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

Re: [BUG?] $terminfo weirdness



Marlon Richert wrote on Tue, 11 May 2021 11:01 +00:00:
> % print -r -- ${(@kvq+)terminfo[(I)kLFT*]}
> kLFT $'\C-[[1;2D'
> % print -r -- ${(@kvq+)terminfo[(I)kLFT]}
> kLFT $'\C-[[1;2D'
> % print -r -- ${(@kvq+)terminfo[(I)kLFT5]}
> 
> % print -r -- ${(@kvq+)terminfo[kLFT5]}
> $'\C-[[1;5D'
> %
> 
> What's going on here?

That's an artifact of the fact that getting a single key from a special
hash is implemented separately to iterating the hash (getterminfo() v.
scanterminfo()).  With ${[(I)]}, scanterminfo() is used, and evidently
doesn't return "kLFT5"; without it, getterminfo() is used, and calls
tigetstr("kLFT5"), which returns the observed value.  (And by the way,
"kLFT6" and "kLFT7" work too and return \e[1;6D and \e[1;7D
respectively.)

I don't immediately see anything in the documentation of tigetstr() that
documents support for trailing counts in the actual argument.

Next time please spell out what was unexpected about the output.




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