summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2011-08-04 08:30:50 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2011-08-04 08:30:50 +0000
commita3ae9f5d126ee235301322d3ee370e6b2235090c (patch)
tree29af16a5180393bb5b92ff6973d28b2a615be251
parent4a3ce8ab89c73f88559d9c48fdb4ed459a8aceef (diff)
downloadzsh-a3ae9f5d126ee235301322d3ee370e6b2235090c.tar.gz
zsh-a3ae9f5d126ee235301322d3ee370e6b2235090c.zip
29643: set incompfunc to zero when executing hook or trap function
-rw-r--r--Src/Zle/zle_main.c5
-rw-r--r--Src/signals.c4
-rw-r--r--Src/utils.c12
3 files changed, 14 insertions, 7 deletions
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index 771ff2cf0..3cdc3b2ed 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -53,11 +53,6 @@ mod_export int zlecs, zlell;
/**/
mod_export int incompctlfunc;
-/* != 0 if we are in a new style completion function */
-
-/**/
-mod_export int incompfunc;
-
/* != 0 if completion module is loaded */
/**/
diff --git a/Src/signals.c b/Src/signals.c
index a848acdbe..81949843f 100644
--- a/Src/signals.c
+++ b/Src/signals.c
@@ -1184,7 +1184,7 @@ dotrapargs(int sig, int *sigtr, void *sigfn)
traplocallevel = locallevel;
runhookdef(BEFORETRAPHOOK, NULL);
if (*sigtr & ZSIG_FUNC) {
- int osc = sfcontext;
+ int osc = sfcontext, old_incompfunc = incompfunc;
HashNode hn = gettrapnode(sig, 0);
args = znewlinklist();
@@ -1210,8 +1210,10 @@ dotrapargs(int sig, int *sigtr, void *sigfn)
trapisfunc = isfunc = 1;
sfcontext = SFC_SIGNAL;
+ incompfunc = 0;
doshfunc((Shfunc)sigfn, args, 1);
sfcontext = osc;
+ incompfunc= old_incompfunc;
freelinklist(args, (FreeFunc) NULL);
zsfree(name);
} else {
diff --git a/Src/utils.c b/Src/utils.c
index f460c0fb3..439b43aa9 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -40,6 +40,11 @@ mod_export char *scriptname; /* is sometimes a function name */
/**/
mod_export char *scriptfilename;
+/* != 0 if we are in a new style completion function */
+
+/**/
+mod_export int incompfunc;
+
#ifdef MULTIBYTE_SUPPORT
struct widechar_array {
wchar_t *chars;
@@ -1232,8 +1237,10 @@ callhookfunc(char *name, LinkList lnklst, int arrayp, int *retval)
* to a list of jobs generated in a hook.
*/
int osc = sfcontext, osm = stopmsg, stat = 1, ret = 0;
+ int old_incompfunc = incompfunc;
sfcontext = SFC_HOOK;
+ incompfunc = 0;
if ((shfunc = getshfunc(name))) {
ret = doshfunc(shfunc, lnklst, 1);
@@ -1262,6 +1269,7 @@ callhookfunc(char *name, LinkList lnklst, int arrayp, int *retval)
sfcontext = osc;
stopmsg = osm;
+ incompfunc = old_incompfunc;
if (retval)
*retval = ret;
@@ -3216,7 +3224,7 @@ getshfunc(char *nam)
char **
subst_string_by_func(Shfunc func, char *arg1, char *orig)
{
- int osc = sfcontext, osm = stopmsg;
+ int osc = sfcontext, osm = stopmsg, old_incompfunc = incompfunc;
LinkList l = newlinklist();
char **ret;
@@ -3225,6 +3233,7 @@ subst_string_by_func(Shfunc func, char *arg1, char *orig)
addlinknode(l, arg1);
addlinknode(l, orig);
sfcontext = SFC_SUBST;
+ incompfunc = 0;
if (doshfunc(func, l, 1))
ret = NULL;
@@ -3233,6 +3242,7 @@ subst_string_by_func(Shfunc func, char *arg1, char *orig)
sfcontext = osc;
stopmsg = osm;
+ incompfunc = old_incompfunc;
return ret;
}