Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: ** in match specs



I knew trouble would come of that...

  compdef foo foo
  foo() { compadd -M 'r:|.=** r:|=*' test.old.ps test.ps }

And trying `foo t.p<TAB>' removed the `p'. This should fix it.

Bye
 Sven

diff -ru ../z.old/Src/Zle/compmatch.c Src/Zle/compmatch.c
--- ../z.old/Src/Zle/compmatch.c	Thu Mar 30 09:58:19 2000
+++ Src/Zle/compmatch.c	Thu Mar 30 11:55:18 2000
@@ -1699,7 +1699,7 @@
 	*p = e->prefix;
 	ca = a->prefix;
 
-	while (n != op) {
+	while (n) {
 	    e->prefix = cp_cline(n, 0);
 	    a->prefix = cp_cline(ca, 0);
 
@@ -1721,6 +1721,8 @@
 	    min -= n->min;
 	    max -= n->max;
 
+	    if (n == op)
+		break;
 	    n = n->next;
 	}
     }
@@ -1761,7 +1763,10 @@
 		    t->next = NULL;
 		    free_cline(o);
 		    o = tn;
-		    o->flags |= CLF_MISS;
+		    if (po)
+			po->flags |= CLF_MISS;
+		    else
+			o->flags |= CLF_MISS;
 		    continue;
 		}
 	    }
@@ -1773,7 +1778,10 @@
 		    sub_join(o, n, tn, 0);
 
 		    n = tn;
-		    o->flags |= CLF_MISS;
+		    if (po)
+			po->flags |= CLF_MISS;
+		    else
+			o->flags |= CLF_MISS;
 		    continue;
 		}
 	    }
@@ -1832,7 +1840,15 @@
 		    sub_join(o, n, tn, 0);
 
 		    n = tn;
-		    o->flags |= CLF_MISS;
+		    if (po)
+			po->flags |= CLF_MISS;
+		    else
+			o->flags |= CLF_MISS;
+
+		    po = o;
+		    o = o->next;
+		    pn = n;
+		    n = n->next;
 		    continue;
 		} else {
 		    for (t = o; (tn = t->next) && !cmp_anchors(n, tn, 1);
@@ -1846,7 +1862,10 @@
 			else
 			    oo = tn;
 			o = tn;
-			o->flags |= CLF_MISS;
+			if (po)
+			    po->flags |= CLF_MISS;
+			else
+			    o->flags |= CLF_MISS;
 			continue;
 		    } else {
 			if (o->flags & CLF_SUF)

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author