20378: Matthias B.: fix bugs joining with metafied chars.

This commit is contained in:
Peter Stephenson 2004-09-17 09:25:38 +00:00
parent 53383c33b8
commit 037485c4a4
4 changed files with 23 additions and 4 deletions

View File

@ -1,3 +1,9 @@
2004-09-17 Peter Stephenson <pws@csr.com>
* 20378: Matthias B <msb@winterdrache.de>: Src/params.c,
Src/utils.c, B02typeset.ztst: Fix bugs with metafied characters
in tied arrays.
2004-09-16 Peter Stephenson <pws@csr.com>
* 20364: Functions/Completer/_oldlist: use $WIDGETSTYLE.

View File

@ -2643,7 +2643,7 @@ tiedarrsetfn(Param pm, char *x)
if (imeta(dptr->joinchar))
{
sepbuf[0] = Meta;
sepbuf[1] = dptr->joinchar;
sepbuf[1] = dptr->joinchar ^ 32;
sepbuf[2] = '\0';
}
else

View File

@ -1912,16 +1912,14 @@ zjoin(char **arr, int delim, int heap)
ptr = ret = (heap ? (char *) hcalloc(len) : (char *) zshcalloc(len));
for (s = arr; *s; s++) {
strucpy(&ptr, *s);
if (delim) {
if (imeta(delim)) {
*ptr++ = Meta;
*ptr++ = delim ^ 32;
}
else
*ptr++ = delim;
}
}
ptr[-1] = '\0';
ptr[-1 - (imeta(delim) ? 1 : 0)] = '\0';
return ret;
}

View File

@ -183,6 +183,21 @@
>l o c a l
>l:o:c:a l o c a
typeset -T SCALAR=$'l\x83o\x83c\x83a\x83l' array $'\x83'
print $array
typeset -U SCALAR
print $SCALAR $array
0:Tied parameters and uniquified arrays with meta-character as separator
>l o c a l
>lƒoƒcƒa l o c a
typeset -T SCALAR=$'l\000o\000c\000a\000l' array $'\000'
typeset -U SCALAR
print $array
[[ $SCALAR == $'l\000o\000c\000a' ]]
0:Tied parameters and uniquified arrays with NUL-character as separator
>l o c a
typeset -T SCALAR array
typeset +T SCALAR
1:Untying is prohibited