diff options
-rw-r--r-- | Doc/Zsh/compctl.yo | 10 | ||||
-rw-r--r-- | Doc/Zsh/compwid.yo | 10 | ||||
-rw-r--r-- | Src/Zle/complist.c | 18 | ||||
-rw-r--r-- | Src/Zle/zle_tricky.c | 17 |
4 files changed, 30 insertions, 25 deletions
diff --git a/Doc/Zsh/compctl.yo b/Doc/Zsh/compctl.yo index 5ac0a910d..03a47f9c4 100644 --- a/Doc/Zsh/compctl.yo +++ b/Doc/Zsh/compctl.yo @@ -517,16 +517,14 @@ space from the sorted ones, so groups defined as tt(-J files) and tt(-V files) are distinct. ) item(tt(-1))( -If given together with the tt(-J) option, makes duplicate matches in -the group be kept. If given together with the tt(-V) option, makes +If given together with the tt(-V) option, makes only consecutive duplicates in the group be removed. Note that groups with and without this flag are in different name spaces. ) item(tt(-2))( -If given together with the tt(-J) option, behaves the same as -tt(-J). If given together with the tt(-V) option, keep all duplicate -matches. Again, groups with and without this flag are in different -name spaces. +If given together with the tt(-J) or tt(-V) option, makes all +duplicates be kept. Again, groups with and without this flag are in +different name spaces. ) item(tt(-M) var(match-spec))( This defines additional matching control specifications that should be used diff --git a/Doc/Zsh/compwid.yo b/Doc/Zsh/compwid.yo index c8abf7959..6681e7b15 100644 --- a/Doc/Zsh/compwid.yo +++ b/Doc/Zsh/compwid.yo @@ -464,16 +464,14 @@ item(tt(-V) var(name))( Like tt(-J) but naming a unsorted group. ) item(tt(-1))( -If given together with the tt(-J) option, makes duplicate matches in -the group be kept. If given together with the tt(-V) option, makes +If given together with the tt(-V) option, makes only consecutive duplicates in the group be removed. Note that groups with and without this flag are in different name spaces. ) item(tt(-2))( -If given together with the tt(-J) option, behaves the same as -tt(-J). If given together with the tt(-V) option, keep all duplicate -matches. Again, groups with and without this flag are in different -name spaces. +If given together with the tt(-J) or tt(-V) option, makes all +duplicates be kept. Again, groups with and without this flag are in +different name spaces. ) item(tt(-X) var(explanation))( As for tt(compctl) and tt(compgen), the var(explanation) string will be diff --git a/Src/Zle/complist.c b/Src/Zle/complist.c index 25fea68e1..7441db15f 100644 --- a/Src/Zle/complist.c +++ b/Src/Zle/complist.c @@ -315,8 +315,8 @@ putcolstr(Listcols c, char *n, mode_t m) /* Information about the list shown. */ static int noselect, mselect, inselect, mcol, mline, mcols, mlines; -static Cmatch *mmatch, **mtab; -static Cmgroup mgroup, *mgtab; +static Cmatch **mtab, **mmtabp; +static Cmgroup *mgtab, *mgtabp; static struct listcols mcolors; @@ -346,11 +346,11 @@ clprintm(Cmgroup g, Cmatch *mp, int mc, int ml, int lastc, int width, mtab[mm] = mp; mgtab[mm] = g; + mmtabp = mtab + mm; + mgtabp = mgtab + mm; } if (m->gnum == mselect) { mline = ml; - mmatch = mp; - mgroup = g; cc = COL_MA; } else cc = COL_NO; @@ -377,12 +377,12 @@ clprintm(Cmgroup g, Cmatch *mp, int mc, int ml, int lastc, int width, mtab[mx + mm] = mp; mgtab[mx + mm] = g; + mmtabp = mtab + mx + mm; + mgtabp = mgtab + mx + mm; } if (m->gnum == mselect) { mcol = mx; mline = ml; - mmatch = mp; - mgroup = g; zcputs(&mcolors, COL_MA); } else if (buf) putcolstr(&mcolors, path, buf->st_mode); @@ -557,10 +557,8 @@ domenuselect(Hookdef dummy, Chdata dat) break; i = 1; } - p = mtab + mcol + (mline * mcols); - pg = mgtab + mcol + (mline * mcols); - minfo.cur = *p; - minfo.group = *pg; + p = mmtabp; + pg = mgtabp; getk: diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c index 2984b836f..43cb2fe9f 100644 --- a/Src/Zle/zle_tricky.c +++ b/Src/Zle/zle_tricky.c @@ -7192,8 +7192,19 @@ static int matchcmp(Cmatch *a, Cmatch *b) { if ((*a)->disp) { - if ((*b)->disp) - return strcmp((*a)->disp, (*b)->disp); + if ((*b)->disp) { + if ((*a)->flags & CMF_DISPLINE) { + if ((*b)->flags & CMF_DISPLINE) + return strcmp((*a)->disp, (*b)->disp); + else + return -1; + } else { + if ((*b)->flags & CMF_DISPLINE) + return 1; + else + return strcmp((*a)->disp, (*b)->disp); + } + } return -1; } if ((*b)->disp) @@ -7264,7 +7275,7 @@ makearray(LinkList l, int type, int flags, int *np, int *nlp, int *llp) qsort((void *) rp, n, sizeof(Cmatch), (int (*) _((const void *, const void *)))matchcmp); - if (!(flags & (CGF_UNIQALL | CGF_UNIQCON))) { + if (!(flags & CGF_UNIQCON)) { /* And delete the ones that occur more than once. */ for (ap = cp = rp; *ap; ap++) { *cp++ = *ap; |