summary refs log tree commit diff
path: root/Src/Zle
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2001-01-18 14:41:40 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2001-01-18 14:41:40 +0000
commitc06782d95b95f6802da6059378e5ad83a1d57ddd (patch)
tree9cbd570a56a8fcc1aaab0755302c2ba519125548 /Src/Zle
parent0acd646e94fbac27ba99bbfdb775f137e39582b9 (diff)
downloadzsh-c06782d95b95f6802da6059378e5ad83a1d57ddd.tar.gz
zsh-c06782d95b95f6802da6059378e5ad83a1d57ddd.tar.xz
zsh-c06782d95b95f6802da6059378e5ad83a1d57ddd.zip
*** empty log message ***
Diffstat (limited to 'Src/Zle')
-rw-r--r--Src/Zle/compcore.c11
-rw-r--r--Src/Zle/compctl.c4
-rw-r--r--Src/Zle/complist.c8
-rw-r--r--Src/Zle/compresult.c2
-rw-r--r--Src/Zle/zle_main.c1
-rw-r--r--Src/Zle/zle_tricky.c8
6 files changed, 23 insertions, 11 deletions
diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c
index a7ada2564..715e4ffc1 100644
--- a/Src/Zle/compcore.c
+++ b/Src/Zle/compcore.c
@@ -934,7 +934,7 @@ makecomplist(char *s, int incmd, int lst)
 	    amatches = lastmatches;
 	    lmatches = lastlmatches;
 	    if (pmatches) {
-		freematches(pmatches);
+		freematches(pmatches, 1);
 		pmatches = NULL;
 		hasperm = 0;
 	    }
@@ -943,7 +943,7 @@ makecomplist(char *s, int incmd, int lst)
 	    return 0;
 	}
 	if (lastmatches) {
-	    freematches(lastmatches);
+	    freematches(lastmatches, 1);
 	    lastmatches = NULL;
 	}
 	permmatches(1);
@@ -2793,7 +2793,7 @@ permmatches(int last)
 
 	    if (g->perm) {
 		g->perm->next = NULL;
-		freematches(g->perm);
+		freematches(g->perm, 0);
 	    }
 	    g->perm = n;
 
@@ -2909,7 +2909,7 @@ freematch(Cmatch m, int nbeg, int nend)
 
 /**/
 mod_export void
-freematches(Cmgroup g)
+freematches(Cmgroup g, int cm)
 {
     Cmgroup n;
     Cmatch *m;
@@ -2938,5 +2938,6 @@ freematches(Cmgroup g)
 
 	g = n;
     }
-    minfo.cur = NULL;
+    if (cm)
+	minfo.cur = NULL;
 }
diff --git a/Src/Zle/compctl.c b/Src/Zle/compctl.c
index 019e774ac..44bf73700 100644
--- a/Src/Zle/compctl.c
+++ b/Src/Zle/compctl.c
@@ -1848,7 +1848,7 @@ ccmakehookfn(Hookdef dummy, struct ccmakedat *dat)
 	    amatches = lastmatches;
 	    lmatches = lastlmatches;
 	    if (pmatches) {
-		freematches(pmatches);
+		freematches(pmatches, 1);
 		pmatches = NULL;
 		hasperm = 0;
 	    }
@@ -1858,7 +1858,7 @@ ccmakehookfn(Hookdef dummy, struct ccmakedat *dat)
 	    return 0;
 	}
 	if (lastmatches) {
-	    freematches(lastmatches);
+	    freematches(lastmatches, 1);
 	    lastmatches = NULL;
 	}
 	permmatches(1);
diff --git a/Src/Zle/complist.c b/Src/Zle/complist.c
index 714719d62..f0fc7c771 100644
--- a/Src/Zle/complist.c
+++ b/Src/Zle/complist.c
@@ -1812,6 +1812,7 @@ domenuselect(Hookdef dummy, Chdata dat)
 	    amatches = pmatches = lastmatches = NULL;
 	    invalidate_list();
 	    iforcemenu = 1;
+	    comprecursive = 1;
 	    menucomplete(zlenoargs);
 	    iforcemenu = 0;
 
@@ -1865,6 +1866,7 @@ domenuselect(Hookdef dummy, Chdata dat)
 	    s->origll = origll;
 	    accept_last();
 	    handleundo();
+	    comprecursive = 1;
 	    do_menucmp(0);
 	    mselect = (*(minfo.cur))->gnum;
 
@@ -1909,7 +1911,7 @@ domenuselect(Hookdef dummy, Chdata dat)
 	    mlbeg = u->mlbeg;
 	    if (u->lastmatches && lastmatches != u->lastmatches) {
 		if (lastmatches)
-		    freematches(lastmatches);
+		    freematches(lastmatches, 0);
 		amatches = u->amatches;
 		pmatches = u->pmatches;
 		lastmatches = u->lastmatches;
@@ -2236,6 +2238,7 @@ domenuselect(Hookdef dummy, Chdata dat)
 		   !strcmp(cmd->nam, "expand-or-complete-prefix") ||
 		   !strcmp(cmd->nam, "menu-complete") ||
 		   !strcmp(cmd->nam, "menu-expand-or-complete")) {
+	    comprecursive = 1;
 	    do_menucmp(0);
 	    mselect = (*(minfo.cur))->gnum;
 	    setwish = 1;
@@ -2243,6 +2246,7 @@ domenuselect(Hookdef dummy, Chdata dat)
 	    continue;
 	} else if (cmd == Th(z_reversemenucomplete) ||
 		   !strcmp(cmd->nam, "reverse-menu-complete")) {
+	    comprecursive = 1;
 	    reversemenucomplete(zlenoargs);
 	    mselect = (*(minfo.cur))->gnum;
 	    setwish = 1;
@@ -2265,7 +2269,7 @@ domenuselect(Hookdef dummy, Chdata dat)
     if (u)
 	for (; u; u = u->prev)
 	    if (u->lastmatches != lastmatches)
-		freematches(u->lastmatches);
+		freematches(u->lastmatches, 0);
 
     selectlocalmap(NULL);
     mselect = mlastcols = mlastlines = -1;
diff --git a/Src/Zle/compresult.c b/Src/Zle/compresult.c
index f953e0f6b..787e7e795 100644
--- a/Src/Zle/compresult.c
+++ b/Src/Zle/compresult.c
@@ -2206,7 +2206,7 @@ invalidate_list(void)
     if (validlist) {
 	if (showinglist == -2)
 	    zrefresh();
-	freematches(lastmatches);
+	freematches(lastmatches, 1);
 	lastmatches = NULL;
 	hasoldlist = 0;
     }
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index c5923d74d..d867a0fb2 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -1129,6 +1129,7 @@ setup_(Module m)
     /* miscellaneous initialisations */
     stackhist = stackcs = -1;
     kungetbuf = (char *) zalloc(kungetsz = 32);
+    comprecursive = 0;
 
     /* initialise the keymap system */
     init_keymaps();
diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
index 7476b833b..e97bd1f6d 100644
--- a/Src/Zle/zle_tricky.c
+++ b/Src/Zle/zle_tricky.c
@@ -145,6 +145,11 @@ mod_export char **cfargs;
 /**/
 mod_export int cfret;
 
+/* != 0 if recursive calls to completion are (temporarily) allowed */
+
+/**/
+mod_export int comprecursive;
+
 /* Find out if we have to insert a tab (instead of trying to complete). */
 
 /**/
@@ -540,11 +545,12 @@ docomplete(int lst)
     char *s, *ol;
     int olst = lst, chl = 0, ne = noerrs, ocs, ret = 0, dat[2];
 
-    if (active) {
+    if (active && !comprecursive) {
 	zwarn("completion cannot be used recursively (yet)", NULL, 0);
 	return 1;
     }
     active = 1;
+    comprecursive = 0;
     if (undoing)
 	setlastline();