about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>2000-02-16 10:57:11 +0000
committerTanaka Akira <akr@users.sourceforge.net>2000-02-16 10:57:11 +0000
commit15996aeeecedf3b94447213ea4c473650cf8afb4 (patch)
tree20970d3968f18652f48047b42c4bc068fb4af35b /Src
parentd5980018d5423274e4beb771974f4c935b309241 (diff)
downloadzsh-15996aeeecedf3b94447213ea4c473650cf8afb4.tar.gz
zsh-15996aeeecedf3b94447213ea4c473650cf8afb4.tar.xz
zsh-15996aeeecedf3b94447213ea4c473650cf8afb4.zip
zsh-workers/9759
Diffstat (limited to 'Src')
-rw-r--r--Src/Zle/comp.h3
-rw-r--r--Src/Zle/compcore.c6
-rw-r--r--Src/Zle/compctl.c9
-rw-r--r--Src/Zle/complete.c1
4 files changed, 18 insertions, 1 deletions
diff --git a/Src/Zle/comp.h b/Src/Zle/comp.h
index f318b4049..9f2fb359a 100644
--- a/Src/Zle/comp.h
+++ b/Src/Zle/comp.h
@@ -364,7 +364,8 @@ typedef void (*CLPrintFunc)(Cmgroup, Cmatch *, int, int, int, int,
 #define INSERTMATCHHOOK     (comphooks + 0)
 #define MENUSTARTHOOK       (comphooks + 1)
 #define COMPCTLMAKEHOOK     (comphooks + 2)
-#define COMPLISTMATCHESHOOK (comphooks + 3)
+#define COMPCTLCLEANUPHOOK  (comphooks + 3)
+#define COMPLISTMATCHESHOOK (comphooks + 4)
 
 /* compctl hook data struct */
 
diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c
index feadfa3b1..0908fb120 100644
--- a/Src/Zle/compcore.c
+++ b/Src/Zle/compcore.c
@@ -844,6 +844,9 @@ makecomplist(char *s, int incmd, int lst)
 	callcompfunc(s, compfunc);
 	endcmgroup(NULL);
 
+	/* Needed for compcall. */
+	runhookdef(COMPCTLCLEANUPHOOK, NULL);
+
 	if (oldlist) {
 	    nmatches = onm;
 	    validlist = 1;
@@ -892,6 +895,9 @@ makecomplist(char *s, int incmd, int lst)
 	dat.lst = lst;
 	runhookdef(COMPCTLMAKEHOOK, (void *) &dat);
 
+	/* Needed for compcall. */
+	runhookdef(COMPCTLCLEANUPHOOK, NULL);
+
 	return dat.lst;
     }
 }
diff --git a/Src/Zle/compctl.c b/Src/Zle/compctl.c
index 2f2e298e6..f3673df52 100644
--- a/Src/Zle/compctl.c
+++ b/Src/Zle/compctl.c
@@ -1892,6 +1892,13 @@ ccmakehookfn(Hookdef dummy, struct ccmakedat *dat)
     return 0;
 }
 
+static int
+cccleanuphookfn(Hookdef dummy, void *dat)
+{
+    ccused = ccstack = NULL;
+    return 0;
+}
+
 /* This adds a match to the list of matches.  The string to add is given   *
  * in s, the type of match is given in the global variable addwhat and     *
  * the parameter t (if not NULL) is a pointer to a hash node node which    *
@@ -3906,6 +3913,7 @@ int
 boot_(Module m)
 {
     addhookfunc("compctl_make", (Hookfn) ccmakehookfn);
+    addhookfunc("compctl_cleanup", (Hookfn) cccleanuphookfn);
     return (addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab)) != 1);
 }
 
@@ -3914,6 +3922,7 @@ int
 cleanup_(Module m)
 {
     deletehookfunc("compctl_make", (Hookfn) ccmakehookfn);
+    deletehookfunc("compctl_cleanup", (Hookfn) cccleanuphookfn);
     deletebuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
     return 0;
 }
diff --git a/Src/Zle/complete.c b/Src/Zle/complete.c
index 70f95fd0f..e28a67cd4 100644
--- a/Src/Zle/complete.c
+++ b/Src/Zle/complete.c
@@ -1288,6 +1288,7 @@ struct hookdef comphooks[] = {
     HOOKDEF("insert_match", NULL, HOOKF_ALL),
     HOOKDEF("menu_start", NULL, HOOKF_ALL),
     HOOKDEF("compctl_make", NULL, 0),
+    HOOKDEF("compctl_cleanup", NULL, 0),
     HOOKDEF("comp_list_matches", ilistmatches, 0),
 };