Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: completion listing *and* Re: simulation of dabbrev-expand
- X-seq: zsh-workers 8004
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: Re: PATCH: completion listing *and* Re: simulation of dabbrev-expand
- Date: Wed, 22 Sep 1999 17:12:04 +0200 (MET DST)
- In-reply-to: Peter Stephenson's message of Wed, 22 Sep 1999 16:02:05 +0200
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
Peter Stephenson wrote:
> If I type `rpm -^D' (I don't actually have rpm) I get a list which looks
> like:
>
> ...
>
> Hitting tab with selection turned on cycles through starting with the set
> at the bottom (why?)
Because (as I wanted to tell you when I added the `-d' option and then
forgot to do) such `-ld'-matches were still sorted normally but
displayed before the other matches in the same group. The patch should
fix this by sorting them before the other matches.
> It then cycles to --verify at the top. The next
> <TAB> causes the shell to crash. The backtrace doesn't seem to be very
> revealing.
Confusion with the pointer passing back and forth between clprintm()
and domenuselect(). This cleans this up.
Zefram wrote:
> ...
>
> >-J -- sorted list without duplicates
> >-J1 -- sorted list with duplicates (which are all consecutive due to
> > the sorting)
> >-J2 -- same as -J1
>
> That can't be right. -J1 should be removing consecutive duplicates,
> i.e., all duplicates due to the sorting. Shouldn't it?
Ah. Good idea ;-)
> >+item(tt(-2))(
> >+If given together with the tt(-J) option, behaves the same as
> >+tt(-J).
>
> This looks fishy too.
Oh dear... I was really getting confused in the end (I first thought
the other way round until I realised that that would mean that only
with `-J2' would give the normal behaviour; then I changed it and
after that...).
Bye
Sven
diff -u os/Zle/complist.c Src/Zle/complist.c
--- os/Zle/complist.c Wed Sep 22 16:12:31 1999
+++ Src/Zle/complist.c Wed Sep 22 16:55:31 1999
@@ -315,8 +315,8 @@
/* 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 @@
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 @@
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 @@
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 -u os/Zle/zle_tricky.c Src/Zle/zle_tricky.c
--- os/Zle/zle_tricky.c Wed Sep 22 16:12:33 1999
+++ Src/Zle/zle_tricky.c Wed Sep 22 17:02:42 1999
@@ -7192,8 +7192,19 @@
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 @@
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;
diff -u od/Zsh/compctl.yo Doc/Zsh/compctl.yo
--- od/Zsh/compctl.yo Wed Sep 22 16:12:43 1999
+++ Doc/Zsh/compctl.yo Wed Sep 22 17:04:07 1999
@@ -517,16 +517,14 @@
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 -u od/Zsh/compwid.yo Doc/Zsh/compwid.yo
--- od/Zsh/compwid.yo Wed Sep 22 16:12:43 1999
+++ Doc/Zsh/compwid.yo Wed Sep 22 17:04:34 1999
@@ -464,16 +464,14 @@
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
--
Sven Wischnowsky wischnow@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author