1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-02 10:01:11 +02:00

Merge of 23696: assignment to negative subscripts in scalars before the start was broken; now adds at start.

This commit is contained in:
Paul Ackersviller 2007-11-20 03:21:01 +00:00
parent e2bcc2185f
commit cd1b74c303
2 changed files with 20 additions and 1 deletions

View file

@ -1726,8 +1726,11 @@ setstrvalue(Value v, char *val)
}
if (v->start > zlen)
v->start = zlen;
if (v->end < 0)
if (v->end < 0) {
v->end += zlen + 1;
if (v->end < 0)
v->end = 0;
}
else if (v->end > zlen)
v->end = zlen;
x = (char *) zalloc(v->start + strlen(val) + zlen - v->end + 1);

View file

@ -660,3 +660,19 @@
>andsomekept
>andsomekept
x=sprodj
x[-10]=scrumf
print $x
0:Out of range negative scalar subscripts
>scrumfsprodj
a=(some sunny day)
a[-10]=(we\'ll meet again)
print -l $a
0:Out of range negative array subscripts
>we'll
>meet
>again
>some
>sunny
>day