1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-09-21 19:31:50 +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:
Bart Schaefer 2008-03-18 15:14:20 +00:00
parent 3cd59fa065
commit 4625e0eabc
4 changed files with 17 additions and 6 deletions

View File

@ -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,
@ -1012,7 +1019,7 @@
2007-10-26 Peter Stephenson <p.w.stephenson@ntlworld.com>
* unposted: Src/curses.c: zcurses input oops.
* 24024: configure.ac, Doc/Zsh/mod_curses.yo,
Src/Modules/curses.c, Src/Modules/curses_keys.awk: add "zcurses
input" for single character raw input without echoing. Test for
@ -6234,7 +6241,7 @@
* 21316 (modified): Completion/Unix/Command/_less,
Completion/Unix/Type/_ctags_tags: new completion for ctags tags; update
less -t completion to use it
* 21320: Completion/Unix/Command/_screen: complete -D and -R with the
appropriate session types; fix incorrect completion of -c and -dmS
options

View File

@ -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"

View File

@ -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;

View File

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