Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: Re: problem with compctl -M
- X-seq: zsh-workers 5007
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: PATCH: Re: problem with compctl -M
- Date: Tue, 26 Jan 1999 11:33:30 +0100 (MET)
- In-reply-to: Sven Wischnowsky's message of Mon, 25 Jan 1999 10:57:42 +0100 (MET)
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
I wrote:
>
> Matcher definitions with `*'s where to eager to let the other matchers
> take over again, sometimes rejecting possible matches (e.g. with
> `l:|=* r:|=*' the string `tu' didn't match `ftp.tu-berlin.de' since
> the `t' in `ftp' where matched by the `t' in `tu' and then the
> matching code gave up).
> This patch may make things a bit slower (shouldn't be noticeable) but
> it also makes the code smaller and cleaner (that's what makes the
> patch look big).
>
> Again this should work with 3.1.5-pws versions before pws-5.
That patch introduced a bug that could lead to endless recursion.
Bye
Sven
--- os/Zle/zle_tricky.c Mon Jan 25 11:22:36 1999
+++ Src/Zle/zle_tricky.c Tue Jan 26 11:32:46 1999
@@ -1871,7 +1877,7 @@
int il = 0, iw = 0, t, bc = brpl;
char *nw = rw;
Cmlist ms;
- Cmatcher mp;
+ Cmatcher mp, lm = NULL;
Cline lr = NULL;
if (nlp) {
@@ -1887,7 +1893,7 @@
while (ll && lw) {
for (ms = mstack; ms; ms = ms->next) {
for (mp = ms->matcher; mp; mp = mp->next) {
- if (nm == mp)
+ if (nm == mp || lm == mp)
continue;
t = 1;
/* Try to match the prefix, if any. */
@@ -1945,6 +1951,7 @@
*bplp = nw - rw;
bplp = NULL;
}
+ lm = mp;
break;
}
else
@@ -1993,8 +2000,11 @@
break;
}
}
- if (mp)
+ if (mp) {
+ if (mp != lm)
+ lm = NULL;
break;
+ }
}
if (t)
continue;
@@ -2016,6 +2026,7 @@
*bplp = nw - rw;
bplp = NULL;
}
+ lm = NULL;
} else {
if (nlp && *nlp) {
lr->next = freecl;
@@ -2046,7 +2057,7 @@
}
return NULL;
}
- if (nw)
+ if (nlp && nw)
*nw = '\0';
if (ll) {
@@ -2077,7 +2088,7 @@
int il = 0, iw = 0, t, bc = brsl;
char *nw = rw;
Cmlist ms;
- Cmatcher mp;
+ Cmatcher mp, lm = NULL;
Cline lr = NULL;
l += ll;
@@ -2095,6 +2106,8 @@
while (ll && lw) {
for (ms = mstack; ms; ms = ms->next) {
for (mp = ms->matcher; mp; mp = mp->next) {
+ if (nm == mp || lm == mp)
+ continue;
t = 1;
if (mp->flags & CMF_RIGHT) {
if (il < mp->ralen || iw < mp->ralen)
@@ -2150,6 +2163,7 @@
*bslp = nw - rw;
bslp = NULL;
}
+ lm = mp;
break;
}
else
@@ -2193,8 +2207,11 @@
break;
}
}
- if (mp)
+ if (mp) {
+ if (mp != lm)
+ lm = NULL;
break;
+ }
}
if (t)
continue;
@@ -2214,6 +2231,7 @@
*bslp = nw - rw;
bslp = NULL;
}
+ lm = NULL;
} else {
if (nlp && *nlp) {
lr->next = freecl;
@@ -2224,7 +2242,7 @@
}
if (lp)
*lp = iw;
- if (nw)
+ if (nlp && nw)
*nw = '\0';
if (ll) {
--
Sven Wischnowsky wischnow@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author