Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: Don't define internal params directly in hook function scope



Something feels very wrong about this :). I'm not committing it.
(I didn't investigate this at all, it's just based on my observation that wrapping the local in an anonymous function helped, and this also works. It may blow up something).

---
 Src/Zle/compcore.c | 2 ++
 Src/Zle/zle_main.c | 7 ++++++-
 Src/Zle/zle_misc.c | 2 ++
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c
index f50c9e9..6816847 100644
--- a/Src/Zle/compcore.c
+++ b/Src/Zle/compcore.c
@@ -825,6 +825,7 @@ callcompfunc(char *s, char *fn)
 	comp_setunset(rset, (~rset & CP_ALLREALS),
 		      kset, (~kset & CP_ALLKEYS));
 	makezleparams(1);
+	startparamscope();
 	sfcontext = SFC_CWIDGET;
 	NEWHEAPS(compheap) {
 	    LinkList largs = NULL;
@@ -841,6 +842,7 @@ callcompfunc(char *s, char *fn)
 	} OLDHEAPS;
 	sfcontext = osc;
 	endparamscope();
+	endparamscope();
 	lastcmd = 0;
 	incompfunc = icf;
 
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index ef6a29d..71c7c24 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -1383,12 +1383,14 @@ execzlefunc(Thingy func, char **args, int set_bindk)
 	    }
 	    startparamscope();
 	    makezleparams(0);
+	    startparamscope();
 	    sfcontext = SFC_WIDGET;
 	    opts[XTRACE] = 0;
 	    ret = doshfunc(shf, largs, 1);
 	    opts[XTRACE] = oxt;
 	    sfcontext = osc;
 	    endparamscope();
+	    endparamscope();
 	    lastcmd = 0;
 	    r = 1;
 	    redup(osi, 0);
@@ -1878,6 +1880,7 @@ zlebeforetrap(UNUSED(Hookdef dummy), UNUSED(void *dat))
     if (zleactive) {
 	startparamscope();
 	makezleparams(1);
+	startparamscope();
     }
     return 0;
 }
@@ -1885,8 +1888,10 @@ zlebeforetrap(UNUSED(Hookdef dummy), UNUSED(void *dat))
 static int
 zleaftertrap(UNUSED(Hookdef dummy), UNUSED(void *dat))
 {
-    if (zleactive)
+    if (zleactive) {
+	endparamscope();
 	endparamscope();
+    }
 
     return 0;
 }
diff --git a/Src/Zle/zle_misc.c b/Src/Zle/zle_misc.c
index 4669ef2..b4e9f0e 100644
--- a/Src/Zle/zle_misc.c
+++ b/Src/Zle/zle_misc.c
@@ -1609,10 +1609,12 @@ iremovesuffix(ZLE_INT_T c, int keep)
 
 	    startparamscope();
 	    makezleparams(0);
+	    startparamscope();
 	    sfcontext = SFC_COMPLETE;
 	    doshfunc(shfunc, args, 1);
 	    sfcontext = osc;
 	    endparamscope();
+	    endparamscope();
 
 	    if (wasmeta)
 		metafy_line();
-- 
2.2.0.GIT



Messages sorted by: Reverse Date, Date, Thread, Author