about summary refs log tree commit diff
path: root/Src/pattern.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2015-06-05 11:21:22 +0100
committerPeter Stephenson <pws@zsh.org>2015-06-05 11:21:22 +0100
commit2abba7243a736a2fc626f3cc917d8a67014d4d20 (patch)
treec91850e5786a9a8e0c9ebbedc65abbc3a3131cd0 /Src/pattern.c
parent4804a7c5ff144fc7cc974484d16f2f88cc131264 (diff)
downloadzsh-2abba7243a736a2fc626f3cc917d8a67014d4d20.tar.gz
zsh-2abba7243a736a2fc626f3cc917d8a67014d4d20.tar.xz
zsh-2abba7243a736a2fc626f3cc917d8a67014d4d20.zip
35386: expand tabs where useful in builtins outputing function.
Also add to zed -f.

Option is -x <numm>.
Diffstat (limited to 'Src/pattern.c')
-rw-r--r--Src/pattern.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/Src/pattern.c b/Src/pattern.c
index 4e5e8a110..7e07548f9 100644
--- a/Src/pattern.c
+++ b/Src/pattern.c
@@ -2202,20 +2202,15 @@ pattryrefs(Patprog prog, char *string, int stringlen, int unmetalen,
 		if ((patglobflags & GF_MATCHREF) &&
 		    !(patflags & PAT_FILE)) {
 		    char *str = ztrduppfx(patinstart, patinlen);
-		    char *ptr = patinstart;
-		    int mlen = 0;
+		    int mlen;
 
 		    /*
 		     * 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.
+		     * because the string is still metafied.
 		     */
 		    MB_METACHARINIT();
-		    while (ptr < patinstart + patinlen) {
-			mlen++;
-			ptr += MB_METACHARLEN(ptr);
-		    }
+		    mlen = MB_METASTRLEN2END(patinstart, 0,
+					     patinstart + patinlen);
 
 		    setsparam("MATCH", str);
 		    setiparam("MBEGIN",