zsh-workers
 help / color / mirror / code / Atom feed
* bug in 'b' array parameter subscript flag
@ 2009-09-04 23:13 Greg Klanderman
  2009-09-05 19:07 ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Greg Klanderman @ 2009-09-04 23:13 UTC (permalink / raw)
  To: Zsh list


when the 'b' flag is used with the 'i' flag, and there are no elements
to be searched, '0' is incorrectly returned rather than one plus the
array length:

[~] phl| zsh -f
phl% echo $ZSH_VERSION 
4.3.10-dev-1
phl% echo $ZSH_PATCHLEVEL 
1.4718
phl% unsetopt ksharrays
phl% a=(bar) 
phl% echo $#a
1
phl% echo ${a[(ib:2:)foo]}    ## BUG: this should return 2
0
phl% echo ${a[(i)foo]}        ## just like this
2

the 'b' flag works correctly when the number of elements to be
searched is non-zero:

phl% a=(bar baz)
phl% echo $#a             
2
phl% echo ${a[(ib:2:)foo]}
3

also, the 'i' flag alone, with no elements to search works correctly:

phl% a=()
phl% echo $#a             
0
phl% echo ${a[(i)foo]}    
1


cheers,
greg


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

end of thread, other threads:[~2009-09-10  3:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-04 23:13 bug in 'b' array parameter subscript flag Greg Klanderman
2009-09-05 19:07 ` Peter Stephenson
2009-09-10  3:42   ` Greg Klanderman

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).