zsh-workers
 help / color / mirror / code / Atom feed
* [BUG?] $terminfo weirdness
@ 2021-05-11 11:01 Marlon Richert
  2021-05-11 11:20 ` Roman Perepelitsa
  2021-05-11 12:21 ` Daniel Shahaf
  0 siblings, 2 replies; 4+ messages in thread
From: Marlon Richert @ 2021-05-11 11:01 UTC (permalink / raw)
  To: Zsh hackers list

% 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?


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [BUG?] $terminfo weirdness
  2021-05-11 11:01 [BUG?] $terminfo weirdness Marlon Richert
@ 2021-05-11 11:20 ` Roman Perepelitsa
  2021-05-11 12:21 ` Daniel Shahaf
  1 sibling, 0 replies; 4+ messages in thread
From: Roman Perepelitsa @ 2021-05-11 11:20 UTC (permalink / raw)
  To: Marlon Richert; +Cc: Zsh hackers list

On Tue, May 11, 2021 at 1:02 PM Marlon Richert <marlon.richert@gmail.com> wrote:
>
> % 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?

I'm surprised that (kv) works with (I) in the first place. It looks
useful but is this documented somewhere?

  % typeset -A x=(a1 1 a2 2 b 3)
  % print -r -- ${x[(I)a*]}
  a1 a2
  % print -r -- ${(kv)x[(I)a*]}
  a1 1 a2 2

Roman.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [BUG?] $terminfo weirdness
  2021-05-11 11:01 [BUG?] $terminfo weirdness Marlon Richert
  2021-05-11 11:20 ` Roman Perepelitsa
@ 2021-05-11 12:21 ` Daniel Shahaf
  2021-05-11 14:49   ` Bart Schaefer
  1 sibling, 1 reply; 4+ messages in thread
From: Daniel Shahaf @ 2021-05-11 12:21 UTC (permalink / raw)
  To: Marlon Richert, Zsh hackers list

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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [BUG?] $terminfo weirdness
  2021-05-11 12:21 ` Daniel Shahaf
@ 2021-05-11 14:49   ` Bart Schaefer
  0 siblings, 0 replies; 4+ messages in thread
From: Bart Schaefer @ 2021-05-11 14:49 UTC (permalink / raw)
  To: Daniel Shahaf; +Cc: Marlon Richert, Zsh hackers list

On Tue, May 11, 2021 at 5:22 AM Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
>
> With ${[(I)]}, scanterminfo() is used, and evidently
> doesn't return "kLFT5";

There's really no way for it to do so ... it can only return the base
names, not attempt every possible suffix that tigetstr() might
interpret as an argument.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-05-11 14:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-11 11:01 [BUG?] $terminfo weirdness Marlon Richert
2021-05-11 11:20 ` Roman Perepelitsa
2021-05-11 12:21 ` Daniel Shahaf
2021-05-11 14:49   ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).