mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-10-30 05:40:58 +01:00
22572: use of (#m) was broken with pure strings
This commit is contained in:
parent
f34e095f4b
commit
ee9b17ad2a
2 changed files with 29 additions and 0 deletions
|
|
@ -1915,6 +1915,32 @@ pattryrefs(Patprog prog, char *string, int stringlen, int unmetalen,
|
|||
patinlen = (int)prog->patmlen;
|
||||
/* if matching files, must update globbing flags */
|
||||
patglobflags = prog->globend;
|
||||
|
||||
if ((patglobflags & GF_MATCHREF) &&
|
||||
!(patflags & PAT_FILE)) {
|
||||
char *str = ztrduppfx(patinstart, patinlen);
|
||||
char *ptr = patinstart;
|
||||
int mlen = 0;
|
||||
|
||||
/*
|
||||
* Count the characters. We're not using CHARSUB()
|
||||
* because the string is still metafied. We're
|
||||
* not using mb_metastrlen() because that expects
|
||||
* the string to be null terminated.
|
||||
*/
|
||||
MB_METACHARINIT();
|
||||
while (ptr < patinstart + patinlen) {
|
||||
mlen++;
|
||||
ptr += MB_METACHARLEN(ptr);
|
||||
}
|
||||
|
||||
setsparam("MATCH", str);
|
||||
setiparam("MBEGIN",
|
||||
(zlong)(patoffset + !isset(KSHARRAYS)));
|
||||
setiparam("MEND",
|
||||
(zlong)(mlen + patoffset +
|
||||
!isset(KSHARRAYS) - 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue