Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: Completion/matching control problem
- X-seq: zsh-workers 7346
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: Re: PATCH: Completion/matching control problem
- Date: Mon, 2 Aug 1999 14:36:58 +0200 (MET DST)
- In-reply-to: Sven Wischnowsky's message of Mon, 2 Aug 1999 13:28:06 +0200 (MET DST)
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
Felix Rosencrantz wrote:
> Here's a problem with matching control that I encountered. I've been
> meaning to send this patch in for some time. If I understood the code
> better, I think I provide a cleaner test case.
>
> mkdir bug
> cd bug
> touch Abc-Def-Ghij.txt
> touch Abc-def.ghi.jkl_mno.pqr.txt
> touch Abc_def_ghi_jkl_mno_pqr.txt
> compctl -M 'm:{a-z}={A-Z} r:|[.,_-]=*'
> ls a-a<TAB>
There was also a problem in join_strs() which could cause an endless
loop. And if you have a matcher such as `m:-=[-_]', the string
inserted was sometimes not what you'd expect, e.g. after `ls Abc-d<TAB>'
where the `d' was removed. This was caused by the loop in
join_clines() which tried to find matching anchors even if the
prefixes before the current anchors matched. For now I have just
unc-commented that code -- I still like the idea.
Bye
Sven
diff -u os/Zle/zle_tricky.c Src/Zle/zle_tricky.c
--- os/Zle/zle_tricky.c Mon Aug 2 13:29:22 1999
+++ Src/Zle/zle_tricky.c Mon Aug 2 14:31:20 1999
@@ -2871,7 +2871,8 @@
*ap += mp->wlen; *alp -= mp->wlen;
*bp += bl; *blp -= bl;
t = 1;
- }
+ } else
+ t = 0;
}
}
}
@@ -3422,6 +3423,11 @@
}
/* Now see if they have matching anchors. If not, cut the list. */
if (!(o->flags & CLF_MID) && !cmp_anchors(o, n, 1)) {
+#if 0
+ /* This used to search forward for matching anchors.
+ * Unfortunately this does the wrong thing if the prefixes
+ * before the differing anchors match nicely. */
+
Cline t, tn;
for (t = n; (tn = t->next) && !cmp_anchors(o, tn, 1); t = tn);
@@ -3430,6 +3436,7 @@
n = tn;
continue;
} else {
+#endif
if (o->flags & CLF_SUF)
break;
@@ -3438,7 +3445,9 @@
free_cline(o->next);
o->next = NULL;
o->flags |= CLF_MISS;
+#if 0
}
+#endif
}
/* Ok, they are equal, now join the sub-lists. */
if (o->flags & CLF_MID)
--
Sven Wischnowsky wischnow@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author