mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-24 05:11:08 +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>
|
2001-01-11 Sven Wischnowsky <wischnow@zsh.org>
|
||||||
|
|
||||||
* 13339: Doc/Zsh/compwid.yo, Doc/Zsh/contrib.yo,
|
* 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;
|
*orest = NULL;
|
||||||
if (nrest)
|
if (nrest)
|
||||||
*nrest = n;
|
*nrest = n;
|
||||||
|
if (n)
|
||||||
|
ot->flags |= CLF_MISS;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,7 +165,7 @@ static char *
|
||||||
cline_str(Cline l, int ins, int *csp, LinkList posl)
|
cline_str(Cline l, int ins, int *csp, LinkList posl)
|
||||||
{
|
{
|
||||||
Cline s;
|
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 pm, pmax, pmm, pma, sm, smax, smm, sma, d, dm, mid;
|
||||||
int i, j, li = 0, cbr, padd = (ins ? wb - ocs : -ocs);
|
int i, j, li = 0, cbr, padd = (ins ? wb - ocs : -ocs);
|
||||||
Brinfo brp, brs;
|
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))) {
|
if ((s->flags & CLF_DIFF) && (!dm || (s->flags & CLF_MATCHED))) {
|
||||||
d = cs; dm = s->flags & CLF_MATCHED;
|
d = cs; dm = s->flags & CLF_MATCHED;
|
||||||
if (posl)
|
if (posl && (npos = cs + padd) != opos) {
|
||||||
addlinknode(posl, (void *) ((long) (cs + padd)));
|
opos = npos;
|
||||||
|
addlinknode(posl, (void *) ((long) npos));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
li += s->llen;
|
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
|
/* Remember the position if this is the first prefix with
|
||||||
* missing characters. */
|
* missing characters. */
|
||||||
if ((l->flags & CLF_MISS) && !(l->flags & CLF_SUF)) {
|
if ((l->flags & CLF_MISS) && !(l->flags & CLF_SUF)) {
|
||||||
if (posl && l->min != l->max)
|
if (posl && l->min != l->max && (npos = cs + padd) != opos) {
|
||||||
addlinknode(posl, (void *) ((long) (cs + padd)));
|
opos = npos;
|
||||||
|
addlinknode(posl, (void *) ((long) npos));
|
||||||
|
}
|
||||||
if (((pmax < (l->max - l->min) || (pma && l->max != l->min)) &&
|
if (((pmax < (l->max - l->min) || (pma && l->max != l->min)) &&
|
||||||
(!pmm || (l->flags & CLF_MATCHED))) ||
|
(!pmm || (l->flags & CLF_MATCHED))) ||
|
||||||
((l->flags & CLF_MATCHED) && !pmm)) {
|
((l->flags & CLF_MATCHED) && !pmm)) {
|
||||||
|
@ -299,8 +303,10 @@ cline_str(Cline l, int ins, int *csp, LinkList posl)
|
||||||
if (l->flags & CLF_MID)
|
if (l->flags & CLF_MID)
|
||||||
mid = cs;
|
mid = cs;
|
||||||
else if (l->flags & CLF_SUF) {
|
else if (l->flags & CLF_SUF) {
|
||||||
if (posl && l->min != l->max)
|
if (posl && l->min != l->max && (npos = cs + padd) != opos) {
|
||||||
addlinknode(posl, (void *) ((long) (cs + padd)));
|
opos = npos;
|
||||||
|
addlinknode(posl, (void *) ((long) npos));
|
||||||
|
}
|
||||||
if (((smax < (l->min - l->max) || (sma && l->max != l->min)) &&
|
if (((smax < (l->min - l->max) || (sma && l->max != l->min)) &&
|
||||||
(!smm || (l->flags & CLF_MATCHED))) ||
|
(!smm || (l->flags & CLF_MATCHED))) ||
|
||||||
((l->flags & CLF_MATCHED) && !smm)) {
|
((l->flags & CLF_MATCHED) && !smm)) {
|
||||||
|
@ -399,14 +405,16 @@ cline_str(Cline l, int ins, int *csp, LinkList posl)
|
||||||
cs += i;
|
cs += i;
|
||||||
if (j >= 0 && (!dm || (js->flags & CLF_MATCHED))) {
|
if (j >= 0 && (!dm || (js->flags & CLF_MATCHED))) {
|
||||||
d = cs - j; dm = js->flags & CLF_MATCHED;
|
d = cs - j; dm = js->flags & CLF_MATCHED;
|
||||||
if (posl)
|
if (posl && (npos = cs - j + padd) != opos) {
|
||||||
addlinknode(posl, (void *) ((long) (cs - j + padd)));
|
opos = npos;
|
||||||
|
addlinknode(posl, (void *) ((long) npos));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
l = l->next;
|
l = l->next;
|
||||||
}
|
}
|
||||||
if (posl)
|
if (posl && (npos = cs + padd) != opos)
|
||||||
addlinknode(posl, (void *) ((long) (cs + padd)));
|
addlinknode(posl, (void *) ((long) npos));
|
||||||
if (ins) {
|
if (ins) {
|
||||||
int ocs = cs;
|
int ocs = cs;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue