mirror of git://git.code.sf.net/p/zsh/code
24788: ${(m)#...} returns string print width
This commit is contained in:
parent
e5d8a42249
commit
cc026d2339
|
@ -1,3 +1,8 @@
|
|||
2008-04-03 Peter Stephenson <p.w.stephenson@ntlworld.com>
|
||||
|
||||
* 24788: Doc/Zsh/expn.yo, Src/subst.c: ${(m)#...} returns
|
||||
string print width.
|
||||
|
||||
2008-04-03 Peter Stephenson <pws@csr.com>
|
||||
|
||||
* 24787: Src/Zle/zle_main.c, Src/Zle/zle_refresh.c: reset
|
||||
|
|
|
@ -943,11 +943,13 @@ Control characters are always assumed to be one unit wide; this allows the
|
|||
mechanism to be used for generating repetitions of control characters.
|
||||
)
|
||||
item(tt(m))(
|
||||
Only useful together with tt(l) and tt(r) when the tt(MULTIBYTE) option
|
||||
Only useful together with one of the flags tt(l) or tt(r) or with the
|
||||
tt(#) length operator when the tt(MULTIBYTE) option
|
||||
is in effect. Use the character width reported by the system in
|
||||
calculating the how much of the string it occupies. Most printable
|
||||
characters have a width of one unit, however certain Asian character sets
|
||||
and certain special effects use wider characters.
|
||||
calculating the how much of the string it occupies or the overall
|
||||
length of the string. Most printable characters have a width of one
|
||||
unit, however certain Asian character sets and certain special effects
|
||||
use wider characters; combining characters have zero width.
|
||||
)
|
||||
item(tt(r:)var(expr)tt(::)var(string1)tt(::)var(string2)tt(:))(
|
||||
As tt(l), but pad the words on the right and insert var(string2)
|
||||
|
|
|
@ -2589,7 +2589,8 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
|
|||
else if (getlen == 2) {
|
||||
if (*aval)
|
||||
for (len = -sl, ctr = aval;
|
||||
len += sl + MB_METASTRLEN(*ctr), *++ctr;);
|
||||
len += sl + MB_METASTRLEN2(*ctr, multi_width),
|
||||
*++ctr;);
|
||||
}
|
||||
else
|
||||
for (ctr = aval;
|
||||
|
@ -2597,7 +2598,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
|
|||
len += wordcount(*ctr, spsep, getlen > 3), ctr++);
|
||||
} else {
|
||||
if (getlen < 3)
|
||||
len = MB_METASTRLEN(val);
|
||||
len = MB_METASTRLEN2(val, multi_width);
|
||||
else
|
||||
len = wordcount(val, spsep, getlen > 3);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue