mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-13 01:31:18 +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>
|
2008-03-15 Peter Stephenson <p.w.stephenson@ntlworld.com>
|
||||||
|
|
||||||
* unposted: Completion/Unix/Command/.distfiles,
|
* unposted: Completion/Unix/Command/.distfiles,
|
||||||
|
|
|
@ -1438,7 +1438,7 @@ number of completions. Please enter:
|
||||||
done
|
done
|
||||||
amenu=(${=menu})
|
amenu=(${=menu})
|
||||||
elt=${amenu[(i)*select*]}
|
elt=${amenu[(i)*select*]}
|
||||||
[[ $elt -gt $#amenu ]] && elt=
|
[[ $elt -eq 0 || $elt -gt $#amenu ]] && elt=
|
||||||
case $select in
|
case $select in
|
||||||
<->) if [[ -n $elt ]]; then
|
<->) if [[ -n $elt ]]; then
|
||||||
amenu[$elt]="select=$select"
|
amenu[$elt]="select=$select"
|
||||||
|
|
|
@ -1317,7 +1317,7 @@ getarg(char **str, int *inv, Value v, int a2, zlong *w,
|
||||||
} else
|
} else
|
||||||
ta = getarrvalue(v);
|
ta = getarrvalue(v);
|
||||||
if (!ta || !*ta)
|
if (!ta || !*ta)
|
||||||
return 0;
|
return !down;
|
||||||
len = arrlen(ta);
|
len = arrlen(ta);
|
||||||
if (beg < 0)
|
if (beg < 0)
|
||||||
beg += len;
|
beg += len;
|
||||||
|
|
|
@ -178,11 +178,15 @@
|
||||||
>lower
|
>lower
|
||||||
>upper
|
>upper
|
||||||
|
|
||||||
typeset -a empty_array
|
typeset -ga empty
|
||||||
echo X${${l##*}[-1]}X
|
echo X${${empty##*}[-1]}X
|
||||||
0:Negative index applied to substition result from empty array
|
0:Negative index applied to substition result from empty array
|
||||||
>XX
|
>XX
|
||||||
|
|
||||||
|
print $empty[(i)] $empty[(I)]
|
||||||
|
0:(i) returns 1 for empty array, (I) returns 0.
|
||||||
|
>1 0
|
||||||
|
|
||||||
array=(one two three four)
|
array=(one two three four)
|
||||||
print X$array[0]X
|
print X$array[0]X
|
||||||
0:Element zero is empty if KSH_ZERO_SUBSCRIPT is off.
|
0:Element zero is empty if KSH_ZERO_SUBSCRIPT is off.
|
||||||
|
|
Loading…
Reference in a new issue