about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Completion/Base/_regex_arguments2
-rw-r--r--Src/Modules/zutil.c10
2 files changed, 6 insertions, 6 deletions
diff --git a/Completion/Base/_regex_arguments b/Completion/Base/_regex_arguments
index 3d4bdd8b1..d898a96fb 100644
--- a/Completion/Base/_regex_arguments
+++ b/Completion/Base/_regex_arguments
@@ -70,7 +70,7 @@ _regex_arguments () {
   "$funcname"' () {
     local _ra_p1 _ra_p2 _ra_left _ra_right _ra_com
     local _ra_actions _ra_line="${(pj:\0:)${(@)words[1,CURRENT - 1]:Q}}"$'\''\0'\''"$PREFIX"
-    regexparse _ra_p1 _ra_p2 "$_ra_line" '"${(j: :)${(qqqq)regex[@]}}"'
+    regexparse -c _ra_p1 _ra_p2 "$_ra_line" '"${(j: :)${(qqqq)regex[@]}}"'
     case "$?" in
     0|2) _message "no more arguments";;
     1) 
diff --git a/Src/Modules/zutil.c b/Src/Modules/zutil.c
index fb95fdcdc..742baf7fb 100644
--- a/Src/Modules/zutil.c
+++ b/Src/Modules/zutil.c
@@ -992,7 +992,7 @@ rparsealt(RParseResult *result, jmp_buf *perr)
 }
 
 static int
-rmatch(RParseResult *sm, char *subj, char *var1, char *var2)
+rmatch(RParseResult *sm, char *subj, char *var1, char *var2, int comp)
 {
     LinkNode ln, lnn;
     LinkList nexts;
@@ -1080,8 +1080,8 @@ rmatch(RParseResult *sm, char *subj, char *var1, char *var2)
 	}
     } while(ln);
 
-    if(!*subj)
-        for(ln = firstnode(sm->out); ln; ln = nextnode(ln)) {
+    if(!comp && !*subj)
+	for(ln = firstnode(sm->out); ln; ln = nextnode(ln)) {
 	    br = getdata(ln);
 	    if(br->state == st) {
 		for(ln = firstnode(br->actions); ln; ln = nextnode(ln)) {
@@ -1141,7 +1141,7 @@ bin_regexparse(char *nam, char **args, char *ops, int func)
 	    ret = 0;
 
 	if(!ret)
-	    ret = rmatch(&result, subj, var1, var2);
+	    ret = rmatch(&result, subj, var1, var2, ops['c']);
         popheap();
     } LASTALLOC;
 
@@ -1152,7 +1152,7 @@ bin_regexparse(char *nam, char **args, char *ops, int func)
 static struct builtin bintab[] = {
     BUILTIN("zstyle", 0, bin_zstyle, 0, -1, 0, NULL, NULL),
     BUILTIN("zformat", 0, bin_zformat, 3, -1, 0, NULL, NULL),
-    BUILTIN("regexparse", 0, bin_regexparse, 3, -1, 0, NULL, NULL),
+    BUILTIN("regexparse", 0, bin_regexparse, 3, -1, 0, "c", NULL),
 };