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

Re: PATCH: tricky.c and completion functions



I wrote:

> There was a bug with matching control (it didn't compare the strings
> for the anchors on the line and in the word).

Here is a fix for another bug: if you have `-M "r:|[-.]=*"' and the
matches `a-b.c' and `a.c' doing `a.<TAB>' removed the dot because it
didn't look ahead for matching anchors in both strings (only in one).

Bye
 Sven

diff -u os/Zle/zle_tricky.c Src/Zle/zle_tricky.c
--- os/Zle/zle_tricky.c	Fri Aug 13 14:16:37 1999
+++ Src/Zle/zle_tricky.c	Tue Aug 17 10:15:46 1999
@@ -2147,7 +2147,7 @@
 	wl = m->llen; w = l;
     }
     if (wl) {
-	/* Probably resie the buffer. */
+	/* Probably resize the buffer. */
 	if (matchbuflen - matchbufadded <= wl) {
 	    int blen = matchbuflen + wl + 20;
 	    char *buf;
@@ -3458,21 +3458,35 @@
 		for (t = n; (tn = t->next) && !cmp_anchors(o, tn, 1); t = tn);
 
 		if (tn) {
-		    Cline t;
-
 		    t = tn->prefix; tn->prefix = n->prefix; n->prefix = t;
 		    t = tn->suffix; tn->suffix = n->suffix; n->suffix = t;
 		    n = tn;
+		    o->flags |= CLF_MISS;
 		    continue;
 		} else {
-		    if (o->flags & CLF_SUF)
-			break;
+		    for (t = o; (tn = t->next) && !cmp_anchors(n, tn, 1);
+			 t = tn);
 
-		    o->word = o->line = o->orig = NULL;
-		    o->wlen = 0;
-		    free_cline(o->next);
-		    o->next = NULL;
-		    o->flags |= CLF_MISS;
+		    if (tn) {
+			t = tn->prefix; tn->prefix = o->prefix; o->prefix = t;
+			t = tn->suffix; tn->suffix = o->suffix; o->suffix = t;
+			if (po)
+			    po->next = tn;
+			else
+			    oo = tn;
+			o = tn;
+			o->flags |= CLF_MISS;
+			continue;
+		    } else {
+			if (o->flags & CLF_SUF)
+			    break;
+
+			o->word = o->line = o->orig = NULL;
+			o->wlen = 0;
+			free_cline(o->next);
+			o->next = NULL;
+			o->flags |= CLF_MISS;
+		    }
 		}
 	    }
 	    /* Ok, they are equal, now join the sub-lists. */

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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