about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
Diffstat (limited to 'Src')
-rw-r--r--Src/Zle/compcore.c22
-rw-r--r--Src/Zle/complete.c4
2 files changed, 14 insertions, 12 deletions
diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c
index 01586a7a2..d4561c469 100644
--- a/Src/Zle/compcore.c
+++ b/Src/Zle/compcore.c
@@ -1686,6 +1686,17 @@ addmatches(Cadata dat, char **argv)
 		    }
 		}
 	    }
+	    /* Select the group in which to store the matches. */
+	    gflags = (((dat->aflags & CAF_NOSORT ) ? CGF_NOSORT  : 0) |
+		      ((dat->aflags & CAF_UNIQALL) ? CGF_UNIQALL : 0) |
+		      ((dat->aflags & CAF_UNIQCON) ? CGF_UNIQCON : 0));
+	    if (dat->group) {
+		endcmgroup(NULL);
+		begcmgroup(dat->group, gflags);
+	    } else {
+		endcmgroup(NULL);
+		begcmgroup("default", 0);
+	    }
 	    if (*argv) {
 		if (dat->pre)
 		    dat->pre = dupstring(dat->pre);
@@ -1696,17 +1707,6 @@ addmatches(Cadata dat, char **argv)
 		    untokenize(dat->prpre);
 		} else
 		    dat->prpre = dupstring(dat->prpre);
-		/* Select the group in which to store the matches. */
-		gflags = (((dat->aflags & CAF_NOSORT ) ? CGF_NOSORT  : 0) |
-			  ((dat->aflags & CAF_UNIQALL) ? CGF_UNIQALL : 0) |
-			  ((dat->aflags & CAF_UNIQCON) ? CGF_UNIQCON : 0));
-		if (dat->group) {
-		    endcmgroup(NULL);
-		    begcmgroup(dat->group, gflags);
-		} else {
-		    endcmgroup(NULL);
-		    begcmgroup("default", 0);
-		}
 		/* Select the set of matches. */
 		oisalt = (dat->aflags & CAF_ALT);
 
diff --git a/Src/Zle/complete.c b/Src/Zle/complete.c
index f52ac98ef..1841514a1 100644
--- a/Src/Zle/complete.c
+++ b/Src/Zle/complete.c
@@ -599,7 +599,9 @@ bin_compadd(char *name, char **argv, char *ops, int func)
 	}
     }
  ca_args:
-    if (!*argv)
+
+    if (!*argv && !dat.group &&
+	!(dat.aflags & (CAF_NOSORT|CAF_UNIQALL|CAF_UNIQCON)))
 	return 1;
 
     dat.match = match = cpcmatcher(match);