From 949f5b6deefb7d4944f1b59fe2264ac0821a3304 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Tue, 25 Apr 2006 15:00:25 +0000 Subject: 22431: set WIDGET etc. more consistently when executing zle functions --- Src/Zle/zle_main.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'Src/Zle/zle_main.c') diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c index f21dea9cc..904bf148e 100644 --- a/Src/Zle/zle_main.c +++ b/Src/Zle/zle_main.c @@ -862,7 +862,7 @@ zlecore(void) eofsent = 1; break; } - if (execzlefunc(bindk, zlenoargs)) { + if (execzlefunc(bindk, zlenoargs, 0)) { handlefeep(zlenoargs); if (eofsent) break; @@ -1011,7 +1011,7 @@ zleread(char **lp, char **rp, int flags, int context) char *args[2]; args[0] = initthingy->nam; args[1] = NULL; - execzlefunc(initthingy, args); + execzlefunc(initthingy, args, 1); unrefthingy(initthingy); errflag = retflag = 0; } @@ -1040,14 +1040,22 @@ zleread(char **lp, char **rp, int flags, int context) return s; } -/* execute a widget */ +/* + * Execute a widget. The third argument indicates that the global + * variable bindk should be set temporarily so that WIDGET etc. + * reflect the command being executed. + */ /**/ int -execzlefunc(Thingy func, char **args) +execzlefunc(Thingy func, char **args, int set_bindk) { int r = 0, ret = 0; Widget w; + Thingy save_bindk = bindk; + + if (set_bindk) + bindk = func; if(func->flags & DISABLED) { /* this thingy is not the name of a widget */ @@ -1143,6 +1151,8 @@ execzlefunc(Thingy func, char **args) refthingy(func); lbindk = func; } + if (set_bindk) + bindk = save_bindk; return ret; } -- cgit 1.4.1