diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2006-08-01 11:58:04 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2006-08-01 11:58:04 +0000 |
commit | ee9b17ad2a687463a31e67106e9317618b73ad4e (patch) | |
tree | 6f046ec32d0bb113766c7fe5bd7a98a3a5db5c4c | |
parent | f34e095f4bcf47168275124be196a2a1c7be98ed (diff) | |
download | zsh-ee9b17ad2a687463a31e67106e9317618b73ad4e.tar.gz zsh-ee9b17ad2a687463a31e67106e9317618b73ad4e.tar.xz zsh-ee9b17ad2a687463a31e67106e9317618b73ad4e.zip |
22572: use of (#m) was broken with pure strings
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | Src/pattern.c | 26 |
2 files changed, 29 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog index fa6981903..7eab7c1f8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2006-08-01 Peter Stephenson <pws@csr.com> + * 22572: Src/pattern.c, Test/D04parameter.ztst: use of (#m) + was broken with pure strings. + * users/10564: Completion/Unix/Command/_gpg: use appropriate key ring arguments to search key rings. diff --git a/Src/pattern.c b/Src/pattern.c index 9ae00ca94..7d9729c0d 100644 --- a/Src/pattern.c +++ b/Src/pattern.c @@ -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)); + } } } |