1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-01-17 22:31:12 +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;
/* != 0 if we are in a new style completion function */
/**/
mod_export int incompfunc;
/* != 0 if completion module is loaded */
/**/

View file

@ -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 {

View file

@ -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;
}