diff options
author | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2001-01-12 13:50:13 +0000 |
---|---|---|
committer | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2001-01-12 13:50:13 +0000 |
commit | a11115ecee1b5fc02b4b714561ffdbc2d2a3e622 (patch) | |
tree | 46c9e6cfd0fbacf58d9ec3af256e3bfbe3d0d754 /Src/Zle/compresult.c | |
parent | 2a78c248425635ebeca509097a92f5e190174813 (diff) | |
download | zsh-a11115ecee1b5fc02b4b714561ffdbc2d2a3e622.tar.gz zsh-a11115ecee1b5fc02b4b714561ffdbc2d2a3e622.tar.xz zsh-a11115ecee1b5fc02b4b714561ffdbc2d2a3e622.zip |
fix for 13339 (report each position only once) and fixlet for matching: a case where missing characters weren't remembered (13343)
Diffstat (limited to 'Src/Zle/compresult.c')
-rw-r--r-- | Src/Zle/compresult.c | 30 |
1 files changed, 19 insertions, 11 deletions
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; |