diff options
Diffstat (limited to 'Src/Zle')
-rw-r--r-- | Src/Zle/compmatch.c | 2 | ||||
-rw-r--r-- | Src/Zle/compresult.c | 30 |
2 files changed, 21 insertions, 11 deletions
diff --git a/Src/Zle/compmatch.c b/Src/Zle/compmatch.c index 5a46a2616..4a4c1c90e 100644 --- a/Src/Zle/compmatch.c +++ b/Src/Zle/compmatch.c @@ -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; } diff --git a/Src/Zle/compresult.c b/Src/Zle/compresult.c index 061c2a6fd..55e37cd4a 100644 --- a/Src/Zle/compresult.c +++ b/Src/Zle/compresult.c @@ -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; |