1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-11-26 02:30:58 +01:00

29643: set incompfunc to zero when executing hook or trap function

This commit is contained in:
Peter Stephenson 2011-08-04 08:30:50 +00:00
parent 4a3ce8ab89
commit a3ae9f5d12
3 changed files with 14 additions and 7 deletions

View file

@ -53,11 +53,6 @@ mod_export int zlecs, zlell;
/**/ /**/
mod_export int incompctlfunc; mod_export int incompctlfunc;
/* != 0 if we are in a new style completion function */
/**/
mod_export int incompfunc;
/* != 0 if completion module is loaded */ /* != 0 if completion module is loaded */
/**/ /**/

View file

@ -1184,7 +1184,7 @@ dotrapargs(int sig, int *sigtr, void *sigfn)
traplocallevel = locallevel; traplocallevel = locallevel;
runhookdef(BEFORETRAPHOOK, NULL); runhookdef(BEFORETRAPHOOK, NULL);
if (*sigtr & ZSIG_FUNC) { if (*sigtr & ZSIG_FUNC) {
int osc = sfcontext; int osc = sfcontext, old_incompfunc = incompfunc;
HashNode hn = gettrapnode(sig, 0); HashNode hn = gettrapnode(sig, 0);
args = znewlinklist(); args = znewlinklist();
@ -1210,8 +1210,10 @@ dotrapargs(int sig, int *sigtr, void *sigfn)
trapisfunc = isfunc = 1; trapisfunc = isfunc = 1;
sfcontext = SFC_SIGNAL; sfcontext = SFC_SIGNAL;
incompfunc = 0;
doshfunc((Shfunc)sigfn, args, 1); doshfunc((Shfunc)sigfn, args, 1);
sfcontext = osc; sfcontext = osc;
incompfunc= old_incompfunc;
freelinklist(args, (FreeFunc) NULL); freelinklist(args, (FreeFunc) NULL);
zsfree(name); zsfree(name);
} else { } else {

View file

@ -40,6 +40,11 @@ mod_export char *scriptname; /* is sometimes a function name */
/**/ /**/
mod_export char *scriptfilename; mod_export char *scriptfilename;
/* != 0 if we are in a new style completion function */
/**/
mod_export int incompfunc;
#ifdef MULTIBYTE_SUPPORT #ifdef MULTIBYTE_SUPPORT
struct widechar_array { struct widechar_array {
wchar_t *chars; 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. * to a list of jobs generated in a hook.
*/ */
int osc = sfcontext, osm = stopmsg, stat = 1, ret = 0; int osc = sfcontext, osm = stopmsg, stat = 1, ret = 0;
int old_incompfunc = incompfunc;
sfcontext = SFC_HOOK; sfcontext = SFC_HOOK;
incompfunc = 0;
if ((shfunc = getshfunc(name))) { if ((shfunc = getshfunc(name))) {
ret = doshfunc(shfunc, lnklst, 1); ret = doshfunc(shfunc, lnklst, 1);
@ -1262,6 +1269,7 @@ callhookfunc(char *name, LinkList lnklst, int arrayp, int *retval)
sfcontext = osc; sfcontext = osc;
stopmsg = osm; stopmsg = osm;
incompfunc = old_incompfunc;
if (retval) if (retval)
*retval = ret; *retval = ret;
@ -3216,7 +3224,7 @@ getshfunc(char *nam)
char ** char **
subst_string_by_func(Shfunc func, char *arg1, char *orig) 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(); LinkList l = newlinklist();
char **ret; char **ret;
@ -3225,6 +3233,7 @@ subst_string_by_func(Shfunc func, char *arg1, char *orig)
addlinknode(l, arg1); addlinknode(l, arg1);
addlinknode(l, orig); addlinknode(l, orig);
sfcontext = SFC_SUBST; sfcontext = SFC_SUBST;
incompfunc = 0;
if (doshfunc(func, l, 1)) if (doshfunc(func, l, 1))
ret = NULL; ret = NULL;
@ -3233,6 +3242,7 @@ subst_string_by_func(Shfunc func, char *arg1, char *orig)
sfcontext = osc; sfcontext = osc;
stopmsg = osm; stopmsg = osm;
incompfunc = old_incompfunc;
return ret; return ret;
} }