Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: hidden matches in menu-select
- X-seq: zsh-workers 8945
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: Re: PATCH: hidden matches in menu-select
- Date: Wed, 8 Dec 1999 14:49:44 +0100 (MET)
- In-reply-to: "Bart Schaefer"'s message of Wed, 8 Dec 1999 10:13:06 +0000
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
Bart Schaefer wrote:
> (Maybe we should change the color-cap to "du"plicate instead of "mu"ltiple?
> Neither the original paragraph nor this rewite explains the derivation of
> "mu".)
Good idea. I wasn't too lucky with it anyway because we already had
`ma' and `mi'.
This also fixes a small bug which made the listing code think that
(almost) all matches were duplicates.
Bye
Sven
diff -ru ../z.old/Doc/Zsh/mod_complist.yo Doc/Zsh/mod_complist.yo
--- ../z.old/Doc/Zsh/mod_complist.yo Wed Dec 8 14:44:36 1999
+++ Doc/Zsh/mod_complist.yo Wed Dec 8 14:45:02 1999
@@ -167,7 +167,7 @@
in the list (because they differ only in things like prefixes or
suffixes that are not displayed). In the list used for menu-selection,
however, even these matches are shown so that it is possible to select
-them. To highlight such matches the tt(hi) and tt(mu) capabilities in
+them. To highlight such matches the tt(hi) and tt(du) capabilities in
the tt(ZLS_COLORS) and tt(ZLS_COLOURS) parameters are supported for
hidden matches of the first and second kind, respectively.
diff -ru ../z.old/Src/Zle/compcore.c Src/Zle/compcore.c
--- ../z.old/Src/Zle/compcore.c Wed Dec 8 10:09:32 1999
+++ Src/Zle/compcore.c Wed Dec 8 14:20:15 1999
@@ -2368,16 +2368,21 @@
(int (*) _((const void *, const void *)))matchcmp);
if (!(flags & CGF_UNIQCON)) {
+ int dup;
+
/* And delete the ones that occur more than once. */
for (ap = cp = rp; *ap; ap++) {
*cp++ = *ap;
for (bp = ap; bp[1] && matcheq(*ap, bp[1]); bp++, n--);
ap = bp;
/* Mark those, that would show the same string in the list. */
- for (; bp[1] && !(*ap)->disp && !(bp[1])->disp &&
- !strcmp((*ap)->str, (bp[1])->str); bp++)
+ for (dup = 0; bp[1] && !(*ap)->disp && !(bp[1])->disp &&
+ !strcmp((*ap)->str, (bp[1])->str); bp++) {
(bp[1])->flags |= CMF_MULT;
- (*ap)->flags |= CMF_FMULT;
+ dup = 1;
+ }
+ if (dup)
+ (*ap)->flags |= CMF_FMULT;
}
*cp = NULL;
}
@@ -2399,14 +2404,19 @@
*cp = NULL;
}
} else if (!(flags & CGF_UNIQCON)) {
+ int dup;
+
for (ap = cp = rp; *ap; ap++) {
*cp++ = *ap;
for (bp = ap; bp[1] && matcheq(*ap, bp[1]); bp++, n--);
ap = bp;
- for (; bp[1] && !(*ap)->disp && !(bp[1])->disp &&
- !strcmp((*ap)->str, (bp[1])->str); bp++)
+ for (dup = 0; bp[1] && !(*ap)->disp && !(bp[1])->disp &&
+ !strcmp((*ap)->str, (bp[1])->str); bp++) {
(bp[1])->flags |= CMF_MULT;
- (*ap)->flags |= CMF_FMULT;
+ dup = 1;
+ }
+ if (dup)
+ (*ap)->flags |= CMF_FMULT;
}
*cp = NULL;
}
diff -ru ../z.old/Src/Zle/complist.c Src/Zle/complist.c
--- ../z.old/Src/Zle/complist.c Wed Dec 8 10:09:33 1999
+++ Src/Zle/complist.c Wed Dec 8 14:44:42 1999
@@ -58,7 +58,7 @@
#define COL_SP 14
#define COL_MA 15
#define COL_HI 16
-#define COL_MU 17
+#define COL_DU 17
#define NUM_COLS 18
@@ -70,7 +70,7 @@
static char *colnames[] = {
"no", "fi", "di", "ln", "pi", "so", "bd", "cd", "ex", "mi",
- "lc", "rc", "ec", "tc", "sp", "ma", "hi", "mu", NULL
+ "lc", "rc", "ec", "tc", "sp", "ma", "hi", "du", NULL
};
/* Default values. */
@@ -659,7 +659,7 @@
} else if (m->flags & CMF_NOLIST)
zcputs(&mcolors, g->name, COL_HI);
else if (mselect >= 0 && (m->flags & (CMF_MULT | CMF_FMULT)))
- zcputs(&mcolors, g->name, COL_MU);
+ zcputs(&mcolors, g->name, COL_DU);
else
subcols = putmatchcol(&mcolors, g->name, m->disp);
if (subcols)
@@ -698,7 +698,7 @@
} else if (m->flags & CMF_NOLIST)
zcputs(&mcolors, g->name, COL_HI);
else if (mselect >= 0 && (m->flags & (CMF_MULT | CMF_FMULT)))
- zcputs(&mcolors, g->name, COL_MU);
+ zcputs(&mcolors, g->name, COL_DU);
else if (buf)
subcols = putfilecol(&mcolors, g->name, path, buf->st_mode);
else
--
Sven Wischnowsky wischnow@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author