diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2006-04-25 15:00:25 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2006-04-25 15:00:25 +0000 |
commit | 949f5b6deefb7d4944f1b59fe2264ac0821a3304 (patch) | |
tree | 7de8db95eb7906e55339494e59963f56ba54038b | |
parent | 20198effd4b511d27fc8f594f23352ff0ff57f2c (diff) | |
download | zsh-949f5b6deefb7d4944f1b59fe2264ac0821a3304.tar.gz zsh-949f5b6deefb7d4944f1b59fe2264ac0821a3304.tar.xz zsh-949f5b6deefb7d4944f1b59fe2264ac0821a3304.zip |
22431: set WIDGET etc. more consistently when executing zle functions
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | Src/Zle/zle_main.c | 18 | ||||
-rw-r--r-- | Src/Zle/zle_thingy.c | 7 | ||||
-rw-r--r-- | Src/Zle/zle_vi.c | 2 |
4 files changed, 21 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog index f73cc540f..ef1dc7b02 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2006-04-25 Peter Stephenson <pws@csr.com> + * 22431: Src/Zle/zle_main.c, Src/Zle/zle_thingy.c, + Src/Zle/zle_vi.c: expand 22427 to set WIDGET etc. more + consistently when executing functions. + * 22429: Src/pattern.c: bug with pure string matching introduced by 22408. 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; } diff --git a/Src/Zle/zle_thingy.c b/Src/Zle/zle_thingy.c index 209949df2..140aeb06a 100644 --- a/Src/Zle/zle_thingy.c +++ b/Src/Zle/zle_thingy.c @@ -639,7 +639,7 @@ zle_usable() static int bin_zle_call(char *name, char **args, UNUSED(Options ops), UNUSED(char func)) { - Thingy t, savbindk = bindk; + Thingy t; struct modifier modsave = zmod; int ret, saveflag = 0, setbindk = 0; char *wname = *args++, *keymap_restore = NULL, *keymap_tmp; @@ -704,10 +704,7 @@ bin_zle_call(char *name, char **args, UNUSED(Options ops), UNUSED(char func)) } t = rthingy(wname); - if (setbindk) - bindk = t; - ret = execzlefunc(t, args); - bindk = savbindk; + ret = execzlefunc(t, args, setbindk); unrefthingy(t); if (saveflag) zmod = modsave; diff --git a/Src/Zle/zle_vi.c b/Src/Zle/zle_vi.c index 9058905f9..2549af80c 100644 --- a/Src/Zle/zle_vi.c +++ b/Src/Zle/zle_vi.c @@ -181,7 +181,7 @@ getvirange(int wf) * a number of lines is used. If the function used * returns 1, we fail. */ - if ((k2 == bindk) ? dovilinerange() : execzlefunc(k2, zlenoargs)) + if ((k2 == bindk) ? dovilinerange() : execzlefunc(k2, zlenoargs, 1)) ret = -1; if(vichgrepeat) zmult = mult1; |