mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-07 11:41:16 +02:00
fix metafication of ${(#)x}
This commit is contained in:
parent
471184c7c2
commit
0a532a8f7f
3 changed files with 46 additions and 4 deletions
|
@ -1,3 +1,9 @@
|
|||
2007-02-10 Peter Stephenson <p.w.stephenson@ntlworld.com>
|
||||
|
||||
* 23162: Src/subst.c, D07multibyte.ztst: ${(#)x} didn't
|
||||
metafy the result, giving nonsense if x was somewhere between
|
||||
128 and 160.
|
||||
|
||||
2007-02-08 Peter Stephenson <pws@csr.com>
|
||||
|
||||
* unposted: README: add note on 23159 to incompatibilities
|
||||
|
|
12
Src/subst.c
12
Src/subst.c
|
@ -1193,21 +1193,25 @@ static char *
|
|||
substevalchar(char *ptr)
|
||||
{
|
||||
zlong ires = mathevali(ptr);
|
||||
int len;
|
||||
|
||||
if (errflag)
|
||||
return NULL;
|
||||
#ifdef MULTIBYTE_SUPPORT
|
||||
if (isset(MULTIBYTE) && ires > 127) {
|
||||
char buf[10];
|
||||
int dummy;
|
||||
|
||||
/* inefficient: should separate out \U handling from getkeystring */
|
||||
sprintf(buf, "\\U%.8x", (unsigned int)ires);
|
||||
return getkeystring(buf, &dummy, GETKEYS_BINDKEY, NULL);
|
||||
} else {
|
||||
ptr = getkeystring(buf, &len, GETKEYS_BINDKEY, NULL);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
ptr = zhalloc(2);
|
||||
len = 1;
|
||||
sprintf(ptr, "%c", (int)ires);
|
||||
return ptr;
|
||||
}
|
||||
return metafy(ptr, len, META_USEHEAP);
|
||||
}
|
||||
|
||||
/* parameter substitution */
|
||||
|
|
|
@ -326,3 +326,35 @@
|
|||
0:Multibyte characters in print sorting
|
||||
>HAH HEH HÉH HÈH HUH
|
||||
>HAH HEH HUH HÈH HÉH
|
||||
|
||||
# These are control characters in Unicode, so don't show up.
|
||||
# We just want to check they're not being treated as tokens.
|
||||
for x in {128..150}; do
|
||||
print ${(#)x}
|
||||
done | while read line; do
|
||||
print ${#line} $(( #line ))
|
||||
done
|
||||
0:evaluated character number with multibyte characters
|
||||
>1 128
|
||||
>1 129
|
||||
>1 130
|
||||
>1 131
|
||||
>1 132
|
||||
>1 133
|
||||
>1 134
|
||||
>1 135
|
||||
>1 136
|
||||
>1 137
|
||||
>1 138
|
||||
>1 139
|
||||
>1 140
|
||||
>1 141
|
||||
>1 142
|
||||
>1 143
|
||||
>1 144
|
||||
>1 145
|
||||
>1 146
|
||||
>1 147
|
||||
>1 148
|
||||
>1 149
|
||||
>1 150
|
||||
|
|
Loading…
Reference in a new issue