mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-05 11:01:13 +02:00
24717, 24718, 24719: a 0 subscript is neither valid nor equivalent to 1
any longer, so the (i) subscript flag on an empty array needs to yield 1.
This commit is contained in:
parent
3cd59fa065
commit
4625e0eabc
4 changed files with 17 additions and 6 deletions
|
@ -1,3 +1,10 @@
|
|||
2008-03-18 Barton E. Schaefer <schaefer@zsh.org>
|
||||
|
||||
* 24717, 24718, 24719: Completion/compinstall, Src/params.c,
|
||||
Test/D06subscript.ztst: a 0 subscript is neither valid nor
|
||||
equivalent to 1 any longer, so the (i) subscript flag on an empty
|
||||
array needs to yield 1 as it probably always should have.
|
||||
|
||||
2008-03-15 Peter Stephenson <p.w.stephenson@ntlworld.com>
|
||||
|
||||
* unposted: Completion/Unix/Command/.distfiles,
|
||||
|
|
|
@ -1438,7 +1438,7 @@ number of completions. Please enter:
|
|||
done
|
||||
amenu=(${=menu})
|
||||
elt=${amenu[(i)*select*]}
|
||||
[[ $elt -gt $#amenu ]] && elt=
|
||||
[[ $elt -eq 0 || $elt -gt $#amenu ]] && elt=
|
||||
case $select in
|
||||
<->) if [[ -n $elt ]]; then
|
||||
amenu[$elt]="select=$select"
|
||||
|
|
|
@ -1317,7 +1317,7 @@ getarg(char **str, int *inv, Value v, int a2, zlong *w,
|
|||
} else
|
||||
ta = getarrvalue(v);
|
||||
if (!ta || !*ta)
|
||||
return 0;
|
||||
return !down;
|
||||
len = arrlen(ta);
|
||||
if (beg < 0)
|
||||
beg += len;
|
||||
|
|
|
@ -178,11 +178,15 @@
|
|||
>lower
|
||||
>upper
|
||||
|
||||
typeset -a empty_array
|
||||
echo X${${l##*}[-1]}X
|
||||
typeset -ga empty
|
||||
echo X${${empty##*}[-1]}X
|
||||
0:Negative index applied to substition result from empty array
|
||||
>XX
|
||||
|
||||
print $empty[(i)] $empty[(I)]
|
||||
0:(i) returns 1 for empty array, (I) returns 0.
|
||||
>1 0
|
||||
|
||||
array=(one two three four)
|
||||
print X$array[0]X
|
||||
0:Element zero is empty if KSH_ZERO_SUBSCRIPT is off.
|
||||
|
|
Loading…
Reference in a new issue