zsh-workers
 help / color / mirror / code / Atom feed
* Re: PATCH: was: Re: Inserting all completions
@ 1999-09-23  7:27 Sven Wischnowsky
  0 siblings, 0 replies; 3+ messages in thread
From: Sven Wischnowsky @ 1999-09-23  7:27 UTC (permalink / raw)
  To: zsh-workers


I wrote:

> ...
>
> This also made me notice a uglyness which also happens when using
> menu-completion and accept-and-menu-completed in braces. If you have a 
> match spec like `m:{a-z}={A-Z}' and to `z{<TAB>' in the Src directory, 
> you get `Zle' as one possible match. But if you accept that and then
> continue selecting other matches the character before the `{' has the
> wrong case for at least one of the matches. Since the `all' value
> basically uses the same code, it has the same problem. I have no idea
> how to solve this. Any suggestions. (The obvious solution would be to
> not use any matches that don't have the same prefix any more, but that 
> might be hard to implement. I'll have to think some more about this.)

The patch tries to fix this by comparing the prefix/suffix
before/after the brace with every would-be-match before
mennu-completing to it. Without menu-select, it even tries to
redisplay the list of matches if it was already displayed and inside a 
menu-selection, the list actually changes (play with
`accept-and-menu-complete' and `undo' to see this).

This also contains some small fixes in the listing code (at one place
a closing brace slipped too far up, it seems).

Bye
 Sven

diff -u os/Zle/comp.h Src/Zle/comp.h
--- os/Zle/comp.h	Wed Sep 22 17:12:39 1999
+++ Src/Zle/comp.h	Thu Sep 23 09:00:33 1999
@@ -239,13 +239,14 @@
     int gnum;			/* global number */
 };
 
-#define CMF_FILE      1		/* this is a file */
-#define CMF_REMOVE    2		/* remove the suffix */
-#define CMF_ISPAR     4		/* is paramter expansion */
-#define CMF_PARBR     8		/* paramter expansion with a brace */
-#define CMF_PARNEST  16		/* nested paramter expansion */
-#define CMF_NOLIST   32		/* should not be listed */
-#define CMF_DISPLINE 64		/* display strings one per line */
+#define CMF_FILE       1	/* this is a file */
+#define CMF_REMOVE     2	/* remove the suffix */
+#define CMF_ISPAR      4	/* is paramter expansion */
+#define CMF_PARBR      8	/* paramter expansion with a brace */
+#define CMF_PARNEST   16	/* nested paramter expansion */
+#define CMF_NOLIST    32	/* should not be listed */
+#define CMF_DISPLINE  64	/* display strings one per line */
+#define CMF_HIDE     128	/* temporarily hide this one */
 
 /* Stuff for completion matcher control. */
 
@@ -297,6 +298,8 @@
     int we;			/* non-zero if the cursor was at the end */
     int insc;			/* length of suffix inserted */
     int asked;			/* we asked if the list should be shown */
+    char *prebr;		/* prefix before a brace, if any */
+    char *postbr;		/* suffix after a brace */
 };
 
 /* Flags for compadd and addmatches(). */
@@ -342,6 +345,7 @@
 struct cldata {
     int columns;		/* screen width */
     int lines;			/* screen height */
+    int menuacc;		/* value of global menuacc */
     int valid;			/* no need to calculate anew */
     int nlist;			/* number of matches to list */
     int nlines;			/* number of lines needed */
diff -u os/Zle/complist.c Src/Zle/complist.c
--- os/Zle/complist.c	Wed Sep 22 17:12:40 1999
+++ Src/Zle/complist.c	Thu Sep 23 09:12:09 1999
@@ -346,11 +346,12 @@
 
 	    mtab[mm] = mp;
 	    mgtab[mm] = g;
-	    mmtabp = mtab + mm;
-	    mgtabp = mgtab + mm;
 	}
 	if (m->gnum == mselect) {
+	    int mm = (mcols * ml) + (mcols >> 1);
 	    mline = ml;
+	    mmtabp = mtab + mm;
+	    mgtabp = mgtab + mm;
 	    cc = COL_MA;
 	} else
 	    cc = COL_NO;
@@ -377,12 +378,14 @@
 
 	    mtab[mx + mm] = mp;
 	    mgtab[mx + mm] = g;
-	    mmtabp = mtab + mx + mm;
-	    mgtabp = mgtab + mx + mm;
 	}
 	if (m->gnum == mselect) {
+	    int mm = mcols * ml;
+
 	    mcol = mx;
 	    mline = ml;
+	    mmtabp = mtab + mx + mm;
+	    mgtabp = mgtab + mx + mm;
 	    zcputs(&mcolors, COL_MA);
 	} else if (buf)
 	    putcolstr(&mcolors, path, buf->st_mode);
@@ -514,6 +517,8 @@
 struct menustack {
     Menustack prev;
     char *line;
+    char *brbeg;
+    char *brend;
     int cs, acc;
     struct menuinfo info;
     Cmgroup amatches, pmatches, lmatches;
@@ -559,6 +564,7 @@
 	}
 	p = mmtabp;
 	pg = mgtabp;
+	minfo.cur = *p;
 
     getk:
 
@@ -579,6 +585,8 @@
 	    s->pmatches = pmatches;
 	    s->lmatches = lmatches;
 	    s->acc = menuacc;
+	    s->brbeg = dupstring(brbeg);
+	    s->brend = dupstring(brend);
 	    menucmp = menuacc = 0;
 	    fixsuffix();
 	    validlist = 0;
@@ -604,6 +612,8 @@
 	    memcpy(&(s->info), &minfo, sizeof(struct menuinfo));
 	    s->amatches = s->pmatches = s->lmatches = NULL;
 	    s->acc = menuacc;
+	    s->brbeg = dupstring(brbeg);
+	    s->brend = dupstring(brend);
 	    acceptlast();
 	    do_menucmp(0);
 	    mselect = (*(minfo.cur))->gnum;
@@ -629,6 +639,10 @@
 		lmatches = u->lmatches;
 		hasperm = 1;
 	    }
+	    zsfree(brbeg);
+	    zsfree(brend);
+	    brbeg = ztrdup(u->brbeg);
+	    brend = ztrdup(u->brend);
 	    u = u->prev;
 	    clearlist = 1;
 	} else if (cmd == Th(z_redisplay)) {
diff -u os/Zle/zle_tricky.c Src/Zle/zle_tricky.c
--- os/Zle/zle_tricky.c	Wed Sep 22 17:12:41 1999
+++ Src/Zle/zle_tricky.c	Thu Sep 23 09:00:34 1999
@@ -112,6 +112,9 @@
 /**/
 int menucmp, menuacc;
 
+/**/
+static char *lastprebr, *lastpostbr;
+
 /* Information about menucompletion. */
 
 /**/
@@ -123,7 +126,9 @@
  * brpcs and brscs hold the positions of the re-inserted string in the    *
  * line.                                                                  */
 
-static char *brbeg = NULL, *brend = NULL;
+/**/
+char *brbeg = NULL, *brend = NULL;
+
 static int brpl, brsl, brpcs, brscs, qbrpl, qbrsl, hasunqu;
 
 /* The list of matches.  fmatches contains the matches we first ignore *
@@ -540,14 +545,17 @@
 	return menucomplete(args);
 
     HEAPALLOC {
-	if (minfo.cur == (minfo.group)->matches) {
-	    do {
-		if (!(minfo.group = (minfo.group)->prev))
-		    minfo.group = lmatches;
-	    } while (!(minfo.group)->mcount);
-	    minfo.cur = (minfo.group)->matches + (minfo.group)->mcount - 1;
-	} else
-	    minfo.cur--;
+	do {
+	    if (minfo.cur == (minfo.group)->matches) {
+		do {
+		    if (!(minfo.group = (minfo.group)->prev))
+			minfo.group = lmatches;
+		} while (!(minfo.group)->mcount);
+		minfo.cur = (minfo.group)->matches + (minfo.group)->mcount - 1;
+	    } else
+		minfo.cur--;
+	} while (menuacc &&
+		 !hasbrpsfx(*(minfo.cur), minfo.prebr, minfo.postbr));
 	metafy_line();
 	do_single(*(minfo.cur));
 	unmetafy_line();
@@ -563,6 +571,15 @@
 void
 acceptlast(void)
 {
+    if (!menuacc) {
+	zsfree(minfo.prebr);
+	minfo.prebr = ztrdup(lastprebr);
+	zsfree(minfo.postbr);
+	minfo.postbr = ztrdup(lastpostbr);
+
+	if (listshown)
+	    showinglist = -2;
+    }
     menuacc++;
 
     if (brbeg && *brbeg) {
@@ -1140,13 +1157,16 @@
     }
     /* Otherwise go to the next match in the array... */
     HEAPALLOC {
-	if (!*++(minfo.cur)) {
-	    do {
-		if (!(minfo.group = (minfo.group)->next))
-		    minfo.group = amatches;
-	    } while (!(minfo.group)->mcount);
-	    minfo.cur = minfo.group->matches;
-	}
+	do {
+	    if (!*++(minfo.cur)) {
+		do {
+		    if (!(minfo.group = (minfo.group)->next))
+			minfo.group = amatches;
+		} while (!(minfo.group)->mcount);
+		minfo.cur = minfo.group->matches;
+	    }
+	} while (menuacc &&
+		 !hasbrpsfx(*(minfo.cur), minfo.prebr, minfo.postbr));
 	/* ... and insert it into the command line. */
 	metafy_line();
 	do_single(*(minfo.cur));
@@ -7097,6 +7117,9 @@
 	listshown = 0;
     minfo.cur = NULL;
     minfo.asked = 0;
+    zsfree(minfo.prebr);
+    zsfree(minfo.postbr);
+    minfo.postbr = minfo.prebr = NULL;
     compwidget = NULL;
 }
 
@@ -7954,7 +7977,11 @@
 static int
 instmatch(Cmatch m, int *scs)
 {
-    int l, r = 0, ocs, a = cs;
+    int l, r = 0, ocs, a = cs, brb = 0;
+
+    zsfree(lastprebr);
+    zsfree(lastpostbr);
+    lastprebr = lastpostbr = NULL;
 
     /* Ignored prefix. */
     if (m->ipre) {
@@ -7980,6 +8007,9 @@
     /* Re-insert the brace beginning, if any. */
     if (brbeg && *brbeg) {
 	cs = a + m->brpl + (m->pre ? strlen(m->pre) : 0);
+	lastprebr = (char *) zalloc(cs - a + 1);
+	memcpy(lastprebr, (char *) line + a, cs - a);
+	lastprebr[cs - a] = '\0';
 	l = strlen(brbeg);
 	brpcs = cs;
 	inststrlen(brbeg, 1, l);
@@ -7999,12 +8029,14 @@
 	ocs = brscs = cs;
 	l = strlen(brend);
 	inststrlen(brend, 1, l);
+	brb = cs;
 	r += l;
 	cs = a + l;
     } else
 	brscs = -1;
     /* -S suffix */
-    *scs = cs;
+    if (scs)
+	*scs = cs;
     if (m->suf) {
 	inststrlen(m->suf, 1, (l = strlen(m->suf)));
 	r += l;
@@ -8014,12 +8046,56 @@
 	inststrlen(m->isuf, 1, (l = strlen(m->isuf)));
 	r += l;
     }
+    if (brend && *brend) {
+	lastpostbr = (char *) zalloc(cs - brb + 1);
+	memcpy(lastpostbr, (char *) line + brb, cs - brb);
+	lastpostbr[cs - brb] = '\0';
+    }
     lastend = cs;
     cs = ocs;
 
     return r;
 }
 
+/* Check if the match has the given prefix/suffix before/after the
+ * braces. */
+
+/**/
+int
+hasbrpsfx(Cmatch m, char *pre, char *suf)
+{
+    char *op = lastprebr, *os = lastpostbr;
+    VARARR(char, oline, ll);
+    int oll = ll, ocs = cs, ole = lastend, opcs = brpcs, oscs = brscs, ret;
+
+    memcpy(oline, line, ll);
+
+    lastprebr = lastpostbr = NULL;
+
+    instmatch(m, NULL);
+
+    cs = 0;
+    foredel(ll);
+    spaceinline(oll);
+    memcpy(line, oline, oll);
+    cs = ocs;
+    lastend = ole;
+    brpcs = opcs;
+    brscs = oscs;
+
+    ret = (((!op && !lastprebr) ||
+	    (op && lastprebr && !strcmp(op, lastprebr))) &&
+	   ((!os && !lastpostbr) ||
+	    (os && lastpostbr && !strcmp(os, lastpostbr))));
+
+    zsfree(lastprebr);
+    zsfree(lastpostbr);
+    lastprebr = op;
+    lastpostbr = os;
+
+    return ret;
+}
+
 /* Handle the case were we found more than one match. */
 
 /**/
@@ -8539,8 +8615,8 @@
 Cmatch *
 skipnolist(Cmatch *p)
 {
-    while (*p && (((*p)->flags & CMF_NOLIST) ||
-		  ((*p)->disp && ((*p)->flags & CMF_DISPLINE))))
+    while (*p && (((*p)->flags & (CMF_NOLIST | CMF_HIDE)) ||
+		  ((*p)->disp && ((*p)->flags & (CMF_DISPLINE | CMF_HIDE)))))
 	p++;
 
     return p;
@@ -8579,7 +8655,8 @@
     int max = 0, i;
     VARARR(int, mlens, nmatches + 1);
 
-    if (listdat.valid && lines == listdat.lines && columns == listdat.columns)
+    if (listdat.valid && menuacc == listdat.menuacc &&
+	lines == listdat.lines && columns == listdat.columns)
 	return;
 
     for (g = amatches; g; g = g->next) {
@@ -8625,6 +8702,12 @@
 	    }
 	} else {
 	    for (p = g->matches; (m = *p); p++) {
+		if (menuacc && !hasbrpsfx(m, minfo.prebr, minfo.postbr)) {
+		    m->flags |= CMF_HIDE;
+		    continue;
+		}
+		m->flags &= ~CMF_HIDE;
+
 		if (m->disp) {
 		    if (m->flags & CMF_DISPLINE) {
 			nlines += 1 + printfmt(m->disp, 0, 0, 0);
@@ -8704,11 +8787,12 @@
 		g->width = 0;
 
 		for (p = g->matches; (m = *p); p++)
-		    if (m->disp) {
-			if (!(m->flags & CMF_DISPLINE))
-			    glines += 1 + (mlens[m->gnum] / columns);
-		    } else if (!(m->flags & CMF_NOLIST))
-			glines += 1 + ((1 + mlens[m->gnum]) / columns);
+		    if (!(m->flags & CMF_HIDE))
+			if (m->disp) {
+			    if (!(m->flags & CMF_DISPLINE))
+				glines += 1 + (mlens[m->gnum] / columns);
+			} else if (!(m->flags & CMF_NOLIST))
+			    glines += 1 + ((1 + mlens[m->gnum]) / columns);
 	    }
 	}
 	g->lins = glines;
@@ -8737,7 +8821,8 @@
 			int x, l = 0, v;
 
 			for (mm = columns / g->shortest; mm > g->cols; mm--) {
-			    for (j = i = ml = cl = l = v = x = 0,  k = g->dcount;
+			    for (j = i = ml = cl = l = v = x = 0,
+				     k = g->dcount;
 				 k > 0; k--) {
 				if (ylens[j] > ml)
 				    ml = ylens[j];
@@ -8754,7 +8839,7 @@
 				    v = 0;
 				}
 			    }
-			    if (j < g->dcount) {
+			    if (j < yl) {
 				ws[x++] = ml;
 				cl += ml;
 			    }
@@ -8789,31 +8874,34 @@
 	    } else if (g->width) {
 		if (isset(LISTROWSFIRST)) {
 		    int x, l = 0, v, al;
+		    Cmatch *q;
 
 		    for (mm = columns / g->shortest; mm > g->cols; mm--) {
-			for (j = i = ml = cl = l = v = x = 0,  k = g->dcount;
+			p = q = skipnolist(g->matches);
+			for (i = ml = cl = l = v = x = 0,  k = g->dcount;
 			     k > 0; k--) {
-			    m = g->matches[j];
-			    if (!(m->flags & (m->disp ? CMF_DISPLINE :
-					      CMF_NOLIST))) {
-				al = mlens[m->gnum] + add;
-				if (al > ml)
-				    ml = al;
-				j += mm;
-				v++;
-				if (j >= g->dcount) {
-				    if ((cl += ml) >= columns)
-					break;
-				    ws[x++] = ml;
-				    ml = 0;
-				    j = ++i;
-				    if (v > l)
-					l = v;
-				    v = 0;
-				}
+			    m = *p;
+			    al = mlens[m->gnum] + add;
+			    if (al > ml)
+				ml = al;
+			    for (j = mm; j && *p; j--)
+				p = skipnolist(p + 1);
+
+			    v++;
+			    if (!*p) {
+				if (v > l)
+				    l = v;
+				v = 0;
+
+				if ((cl += ml) >= columns)
+				    break;
+				ws[x++] = ml;
+				ml = 0;
+
+				p = q = skipnolist(q + 1);
 			    }
 			}
-			if (j < g->dcount) {
+			if (v) {
 			    ws[x++] = ml;
 			    cl += ml;
 			}
@@ -8829,8 +8917,9 @@
 			 i < g->lins; i++) {
 			for (p = g->matches, j = k = cl = ml = mm = 0;
 			     (m = *p); p++, j++) {
-			    if (!(m->flags & (m->disp ? CMF_DISPLINE :
-					      CMF_NOLIST))) {
+			    if (!(m->flags &
+				  (m->disp ? (CMF_DISPLINE | CMF_HIDE) :
+				   (CMF_NOLIST | CMF_HIDE)))) {
 				al = mlens[m->gnum] + add;
 				if (al > ml)
 				    ml = al;
@@ -8858,11 +8947,11 @@
 		nlines += i - g->lins;
 		g->lins = i;
 		g->cols = mm;
+		g->totl = cl;
+		cl -= add;
+		if (cl > max)
+		    max = cl;
 	    }
-	    g->totl = cl;
-	    cl -= add;
-	    if (cl > max)
-		max = cl;
 	}
 	for (g = amatches; g; g = g->next) {
 	    if (g->widths) {
@@ -8878,6 +8967,7 @@
     listdat.hidden = hidden;
     listdat.nlist = nlist;
     listdat.nlines = nlines;
+    listdat.menuacc = menuacc;
 }
 
 /**/

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PATCH: was: Re: Inserting all completions
@ 1999-09-20 12:27 Sven Wischnowsky
  0 siblings, 0 replies; 3+ messages in thread
From: Sven Wischnowsky @ 1999-09-20 12:27 UTC (permalink / raw)
  To: zsh-workers


I wrote:

> Currently no completion function uses this. Maybe I'll change
> `_expand' to allow this kind of `expansion', too.

Here it is. Controlled by the key `expand_completions'.

Bye
 Sven

diff -u -r oldcompletion/Commands/_expand_word Completion/Commands/_expand_word
--- oldcompletion/Commands/_expand_word	Mon Sep 20 13:06:50 1999
+++ Completion/Commands/_expand_word	Mon Sep 20 14:24:06 1999
@@ -10,12 +10,14 @@
 local oem="$compconfig[expand_menu]"
 local oeo="$compconfig[expand_original]"
 local oep="$compconfig[expand_prompt]"
+local oec="$compconfig[expand_completions]"
 
 compconfig[expand_substitute]="${compconfig[expandword_substitute]}"
 compconfig[expand_glob]="${compconfig[expandword_glob]-$oeg}"
 compconfig[expand_menu]="${compconfig[expandword_menu]-$oem}"
 compconfig[expand_original]="${compconfig[expandword_original]-$oeo}"
 compconfig[expand_prompt]="${compconfig[expandword_prompt]-$oep}"
+compconfig[expand_completions]="${compconfig[expandword_completions]-$oec}"
 
 _main_complete _expand
 
@@ -24,3 +26,4 @@
 compconfig[expand_menu]="$oem"
 compconfig[expand_original]="$oeo"
 compconfig[expand_prompt]="$oep"
+compconfig[expand_completions]="$oec"
diff -u -r oldcompletion/Core/_expand Completion/Core/_expand
--- oldcompletion/Core/_expand	Mon Sep 20 13:06:51 1999
+++ Completion/Core/_expand	Mon Sep 20 14:18:59 1999
@@ -58,6 +58,14 @@
 
 local exp word="$PREFIX$SUFFIX" group=-V expl expl2 disp
 
+# First, see if we should insert all *completions*.
+
+if [[ -n "$compconfig[expand_completions]" &&
+      "${(e):-\$[$compconfig[expand_substitute]]}" -eq 1 ]]; then
+  compstate[insert]=all
+  return 1
+fi
+
 # Do this only for the first global matcher.
 
 [[ "$compstate[matcher]" -le 1 ]] || return 1
diff -u od/Zsh/compsys.yo Doc/Zsh/compsys.yo
--- od/Zsh/compsys.yo	Mon Sep 20 14:16:47 1999
+++ Doc/Zsh/compsys.yo	Mon Sep 20 14:26:45 1999
@@ -479,6 +479,10 @@
 ifzman(the section `Completion System Configuration' below)\
 ifnzman(noderef(Completion System Configuration)).
 
+In a different mode selected by the tt(expand_completions)
+configuration key, all em(completions) generated for the string on the 
+line are inserted.
+
 None of these configuration keys has a default value.
 )
 item(tt(_list))(
@@ -1346,8 +1350,16 @@
 `tt(%B)', etc. Also, the sequence `tt(%o)' in this string will be
 replaced by the original string.
 )
+item(tt(expand_completions))(
+If this is set and non-empty, its value will be evaluated in the same
+way as tt(expand_substitute) and if the result is `tt(1)', no
+expansions will be generated, but instead the completions will be
+generated as normal and all of them will be inserted in the command
+line.
+)
 item(tt(expandword_substitute), tt(expandword_glob),
-tt(expandword_menu),tt(expandword_original), tt(expandword_prompt))(
+tt(expandword_menu), tt(expandword_original), tt(expandword_prompt),
+tt(expandword_completions))(
 If these keys are set, they are used by the tt(_expand_word) bindable
 command to override the values for the configuration keys with the
 tt(expand_) prefix.

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 3+ messages in thread

* PATCH: was: Re: Inserting all completions
@ 1999-09-20  9:56 Sven Wischnowsky
  0 siblings, 0 replies; 3+ messages in thread
From: Sven Wischnowsky @ 1999-09-20  9:56 UTC (permalink / raw)
  To: zsh-workers


Bart Schaefer wrote:

> [ about the possibility to insert all matches resulting from a
>   completion ]
>
> Maybe all-or-nothing is actually sufficient; what about simply:
> 
> 	compstate[insert]=expand
> 
> Which would act much like the _expand completer with only expand_glob.

This patch adds `all' (not `expand') as a possible value for
`compstate[insert]'. If after the widget has finished it has this
value, all completions are inserted.

The other stuff mentioned in Bart's message will have to wait until we 
have a way to get at the current matches (probably blended with
Peter's suggestion for re-invoking the widget and things like that).

Currently no completion function uses this. Maybe I'll change
`_expand' to allow this kind of `expansion', too.

This also made me notice a uglyness which also happens when using
menu-completion and accept-and-menu-completed in braces. If you have a 
match spec like `m:{a-z}={A-Z}' and to `z{<TAB>' in the Src directory, 
you get `Zle' as one possible match. But if you accept that and then
continue selecting other matches the character before the `{' has the
wrong case for at least one of the matches. Since the `all' value
basically uses the same code, it has the same problem. I have no idea
how to solve this. Any suggestions. (The obvious solution would be to
not use any matches that don't have the same prefix any more, but that 
might be hard to implement. I'll have to think some more about this.)

Bye
 Sven

diff -u os/Zle/zle_tricky.c Src/Zle/zle_tricky.c
--- os/Zle/zle_tricky.c	Sun Sep 19 16:57:28 1999
+++ Src/Zle/zle_tricky.c	Sun Sep 19 17:32:15 1999
@@ -4735,6 +4735,48 @@
 	    inststr(origline);
 	    cs = origcs;
 	    showinglist = -2;
+	} else if (useline == 2 && nmatches > 1) {
+	    int first = 1, nm = nmatches;
+	    Cmatch *mc;
+
+	    menucmp = 1;
+	    menuacc = 0;
+
+	    for (minfo.group = amatches;
+		 minfo.group && !(minfo.group)->mcount;
+		 minfo.group = (minfo.group)->next);
+
+	    mc = (minfo.group)->matches;
+
+	    while (1) {
+		if (!first)
+		    acceptlast();
+		first = 0;
+
+		if (!--nm)
+		    menucmp = 0;
+
+		do_single(*mc);
+		minfo.cur = mc;
+
+		if (!*++(minfo.cur)) {
+		    do {
+			if (!(minfo.group = (minfo.group)->next))
+			    break;
+		    } while (!(minfo.group)->mcount);
+		    if (!minfo.group)
+			break;
+		    minfo.cur = minfo.group->matches;
+		}
+		mc = minfo.cur;
+	    }
+	    menucmp = 0;
+	    minfo.cur = NULL;
+
+	    if (compforcelist && *compforcelist && uselist)
+		showinglist = -2;
+	    else
+		invalidatelist();
 	} else if (useline) {
 	    /* We have matches. */
 	    if (nmatches > 1) {
@@ -4763,7 +4805,7 @@
 	}
 	/* Print the explanation strings if needed. */
 	if (!showinglist && validlist && usemenu != 2 && nmatches != 1 &&
-	    (!oldlist || !listshown)) {
+	    useline != 2 && (!oldlist || !listshown)) {
 	    Cmgroup g = amatches;
 	    Cexpl *e;
 	    int up = 0, tr = 1, nn = 0;
@@ -5074,6 +5116,8 @@
 	else if (!strcmp(compinsert, "auto") ||
 		 !strcmp(compinsert, "automenu"))
 	    useline = 1, usemenu = 2;
+	else if (!strcmp(compinsert, "all"))
+	    useline = 2, usemenu = 0;
 	else if (idigit(*compinsert)) {
 	    char *m;
 
diff -u od/Zsh/compwid.yo Doc/Zsh/compwid.yo
--- od/Zsh/compwid.yo	Sun Sep 19 12:18:54 1999
+++ Doc/Zsh/compwid.yo	Sun Sep 19 17:52:41 1999
@@ -259,6 +259,9 @@
 one more than the maximum selects the first. Unless the value of this
 key ends in a space, the match is inserted as in a menu-completion,
 i.e. without automatically appending a space.
+
+It may also be set to tt(all), which makes all matches generated be
+inserted into the line.
 )
 item(tt(to_end))(
 Specifies the occasions on which the cursor is moved to the end of a string

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1999-09-23  7:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-09-23  7:27 PATCH: was: Re: Inserting all completions Sven Wischnowsky
  -- strict thread matches above, loose matches on Subject: below --
1999-09-20 12:27 Sven Wischnowsky
1999-09-20  9:56 Sven Wischnowsky

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).