summary refs log tree commit diff
path: root/Src/Zle
diff options
context:
space:
mode:
Diffstat (limited to 'Src/Zle')
-rw-r--r--Src/Zle/comp.h1
-rw-r--r--Src/Zle/compcore.c4
-rw-r--r--Src/Zle/complete.c3
3 files changed, 6 insertions, 2 deletions
diff --git a/Src/Zle/comp.h b/Src/Zle/comp.h
index 5e25cdeb6..e88f8b927 100644
--- a/Src/Zle/comp.h
+++ b/Src/Zle/comp.h
@@ -131,6 +131,7 @@ struct cmatch {
 #define CMF_FMULT    (1<<12)	/* first of multiple equal strings */
 #define CMF_ALL      (1<<13)	/* a match representing all other matches */
 #define CMF_DUMMY    (1<<14)	/* unselectable dummy match */
+#define CMF_MORDER   (1<<15)    /* order by matches, not display strings */
 
 /* Stuff for completion matcher control. */
 
diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c
index 1caad5484..008f49185 100644
--- a/Src/Zle/compcore.c
+++ b/Src/Zle/compcore.c
@@ -2735,7 +2735,7 @@ addexpl(int always)
 static int
 matchcmp(Cmatch *a, Cmatch *b)
 {
-    if ((*a)->disp) {
+    if ((*a)->disp && !((*a)->flags & CMF_MORDER)) {
 	if ((*b)->disp) {
 	    if ((*a)->flags & CMF_DISPLINE) {
 		if ((*b)->flags & CMF_DISPLINE)
@@ -2751,7 +2751,7 @@ matchcmp(Cmatch *a, Cmatch *b)
 	}
 	return -1;
     }
-    if ((*b)->disp)
+    if ((*b)->disp && !((*b)->flags & CMF_MORDER))
 	return 1;
 
     return strbpcmp(&((*a)->str), &((*b)->str));
diff --git a/Src/Zle/complete.c b/Src/Zle/complete.c
index e246e2b8a..c70c8c191 100644
--- a/Src/Zle/complete.c
+++ b/Src/Zle/complete.c
@@ -569,6 +569,9 @@ bin_compadd(char *name, char **argv, UNUSED(Options ops), UNUSED(int func))
 	    case 'l':
 		dat.flags |= CMF_DISPLINE;
 		break;
+	    case 'o':
+		dat.flags |= CMF_MORDER;
+		break;
 	    case 'E':
                 if (p[1]) {
                     dat.dummies = atoi(p + 1);