mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-10-30 05:40:58 +01:00
22760: fix partial string length reports with NO_MULTIBYTE
This commit is contained in:
parent
e19955614f
commit
e8edd42f7f
3 changed files with 26 additions and 1 deletions
|
|
@ -1,3 +1,8 @@
|
||||||
|
2017-07-02 Peter Stephenson <p.w.stephenson@ntlworld.com>
|
||||||
|
|
||||||
|
* 22760: Src/utils.c, Test/D04parameter.ztst: NO_MULTIBYTE
|
||||||
|
partial string lengths were reported as full string lengths.
|
||||||
|
|
||||||
2017-06-27 Peter Stephenson <p.stephenson@samsung.com>
|
2017-06-27 Peter Stephenson <p.stephenson@samsung.com>
|
||||||
|
|
||||||
* 41368: Src/Zle/compctl.c: missing unqueue_signals().
|
* 41368: Src/Zle/compctl.c: missing unqueue_signals().
|
||||||
|
|
|
||||||
|
|
@ -5417,7 +5417,7 @@ mb_metastrlenend(char *ptr, int width, char *eptr)
|
||||||
int num, num_in_char, complete;
|
int num, num_in_char, complete;
|
||||||
|
|
||||||
if (!isset(MULTIBYTE))
|
if (!isset(MULTIBYTE))
|
||||||
return ztrlen(ptr);
|
return eptr ? (int)(eptr - ptr) : ztrlen(ptr);
|
||||||
|
|
||||||
laststart = ptr;
|
laststart = ptr;
|
||||||
ret = MB_INVALID;
|
ret = MB_INVALID;
|
||||||
|
|
|
||||||
|
|
@ -783,16 +783,36 @@
|
||||||
0:${(R)...}
|
0:${(R)...}
|
||||||
>is the ,
|
>is the ,
|
||||||
|
|
||||||
|
# Although there's no reliance on multibyte here, the
|
||||||
|
# code exercised is different, so test both paths in the following group.
|
||||||
|
# If the shell isn't multibyte capable the tests are the same;
|
||||||
|
# that's not a problem.
|
||||||
# This (1) doesn't work with // or /
|
# This (1) doesn't work with // or /
|
||||||
# (2) perhaps ought to be 18, to be consistent with normal zsh
|
# (2) perhaps ought to be 18, to be consistent with normal zsh
|
||||||
# substring indexing and with backreferences.
|
# substring indexing and with backreferences.
|
||||||
print ${(BES)string##white}
|
print ${(BES)string##white}
|
||||||
|
(unsetopt multibyte; print ${(BES)string##white})
|
||||||
0:${(BE...)...}
|
0:${(BE...)...}
|
||||||
|
>14 19
|
||||||
>14 19
|
>14 19
|
||||||
|
|
||||||
print ${(NS)string##white}
|
print ${(NS)string##white}
|
||||||
|
(unsetopt multibyte; print ${(NS)string##white})
|
||||||
0:${(N)...}
|
0:${(N)...}
|
||||||
>5
|
>5
|
||||||
|
>5
|
||||||
|
|
||||||
|
fn() {
|
||||||
|
emulate -L zsh
|
||||||
|
local a=abcdef
|
||||||
|
print ${(SNBE)a#abcd}
|
||||||
|
unsetopt multibyte
|
||||||
|
print ${(SNBE)a#abcd}
|
||||||
|
}
|
||||||
|
fn
|
||||||
|
0:${(BEN)...} again, with match
|
||||||
|
>1 5 4
|
||||||
|
>1 5 4
|
||||||
|
|
||||||
string='abcdefghijklmnopqrstuvwxyz'
|
string='abcdefghijklmnopqrstuvwxyz'
|
||||||
print ${${string%[aeiou]*}/(#m)?(#e)/${(U)MATCH}}
|
print ${${string%[aeiou]*}/(#m)?(#e)/${(U)MATCH}}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue