mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-17 02:51:01 +02:00
fix for 13339 (report each position only once) and fixlet for matching: a case where missing characters weren't remembered (13343)
This commit is contained in:
parent
2a78c24842
commit
a11115ecee
3 changed files with 27 additions and 11 deletions
|
@ -1,3 +1,9 @@
|
|||
2001-01-12 Sven Wischnowsky <wischnow@zsh.org>
|
||||
|
||||
* 13343: Src/Zle/compmatch.c, Src/Zle/compresult.c: fix for 13339
|
||||
(report each position only once) and fixlet for matching: a case
|
||||
where missing characters weren't remembered
|
||||
|
||||
2001-01-11 Sven Wischnowsky <wischnow@zsh.org>
|
||||
|
||||
* 13339: Doc/Zsh/compwid.yo, Doc/Zsh/contrib.yo,
|
||||
|
|
|
@ -1627,6 +1627,8 @@ join_psfx(Cline ot, Cline nt, Cline *orest, Cline *nrest, int sfx)
|
|||
*orest = NULL;
|
||||
if (nrest)
|
||||
*nrest = n;
|
||||
if (n)
|
||||
ot->flags |= CLF_MISS;
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -165,7 +165,7 @@ static char *
|
|||
cline_str(Cline l, int ins, int *csp, LinkList posl)
|
||||
{
|
||||
Cline s;
|
||||
int ocs = cs, ncs, pcs, scs;
|
||||
int ocs = cs, ncs, pcs, scs, opos, npos;
|
||||
int pm, pmax, pmm, pma, sm, smax, smm, sma, d, dm, mid;
|
||||
int i, j, li = 0, cbr, padd = (ins ? wb - ocs : -ocs);
|
||||
Brinfo brp, brs;
|
||||
|
@ -224,8 +224,10 @@ cline_str(Cline l, int ins, int *csp, LinkList posl)
|
|||
|
||||
if ((s->flags & CLF_DIFF) && (!dm || (s->flags & CLF_MATCHED))) {
|
||||
d = cs; dm = s->flags & CLF_MATCHED;
|
||||
if (posl)
|
||||
addlinknode(posl, (void *) ((long) (cs + padd)));
|
||||
if (posl && (npos = cs + padd) != opos) {
|
||||
opos = npos;
|
||||
addlinknode(posl, (void *) ((long) npos));
|
||||
}
|
||||
}
|
||||
li += s->llen;
|
||||
}
|
||||
|
@ -247,8 +249,10 @@ cline_str(Cline l, int ins, int *csp, LinkList posl)
|
|||
/* Remember the position if this is the first prefix with
|
||||
* missing characters. */
|
||||
if ((l->flags & CLF_MISS) && !(l->flags & CLF_SUF)) {
|
||||
if (posl && l->min != l->max)
|
||||
addlinknode(posl, (void *) ((long) (cs + padd)));
|
||||
if (posl && l->min != l->max && (npos = cs + padd) != opos) {
|
||||
opos = npos;
|
||||
addlinknode(posl, (void *) ((long) npos));
|
||||
}
|
||||
if (((pmax < (l->max - l->min) || (pma && l->max != l->min)) &&
|
||||
(!pmm || (l->flags & CLF_MATCHED))) ||
|
||||
((l->flags & CLF_MATCHED) && !pmm)) {
|
||||
|
@ -299,8 +303,10 @@ cline_str(Cline l, int ins, int *csp, LinkList posl)
|
|||
if (l->flags & CLF_MID)
|
||||
mid = cs;
|
||||
else if (l->flags & CLF_SUF) {
|
||||
if (posl && l->min != l->max)
|
||||
addlinknode(posl, (void *) ((long) (cs + padd)));
|
||||
if (posl && l->min != l->max && (npos = cs + padd) != opos) {
|
||||
opos = npos;
|
||||
addlinknode(posl, (void *) ((long) npos));
|
||||
}
|
||||
if (((smax < (l->min - l->max) || (sma && l->max != l->min)) &&
|
||||
(!smm || (l->flags & CLF_MATCHED))) ||
|
||||
((l->flags & CLF_MATCHED) && !smm)) {
|
||||
|
@ -399,14 +405,16 @@ cline_str(Cline l, int ins, int *csp, LinkList posl)
|
|||
cs += i;
|
||||
if (j >= 0 && (!dm || (js->flags & CLF_MATCHED))) {
|
||||
d = cs - j; dm = js->flags & CLF_MATCHED;
|
||||
if (posl)
|
||||
addlinknode(posl, (void *) ((long) (cs - j + padd)));
|
||||
if (posl && (npos = cs - j + padd) != opos) {
|
||||
opos = npos;
|
||||
addlinknode(posl, (void *) ((long) npos));
|
||||
}
|
||||
}
|
||||
}
|
||||
l = l->next;
|
||||
}
|
||||
if (posl)
|
||||
addlinknode(posl, (void *) ((long) (cs + padd)));
|
||||
if (posl && (npos = cs + padd) != opos)
|
||||
addlinknode(posl, (void *) ((long) npos));
|
||||
if (ins) {
|
||||
int ocs = cs;
|
||||
|
||||
|
|
Loading…
Reference in a new issue