diff options
Diffstat (limited to 'Src/Zle')
-rw-r--r-- | Src/Zle/comp.h | 3 | ||||
-rw-r--r-- | Src/Zle/compcore.c | 6 | ||||
-rw-r--r-- | Src/Zle/compctl.c | 9 | ||||
-rw-r--r-- | Src/Zle/complete.c | 1 |
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), }; |