diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | Doc/Zsh/zle.yo | 12 | ||||
-rw-r--r-- | Src/Zle/zle_thingy.c | 10 |
3 files changed, 22 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog index 29757e57e..6a08887d7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-04-25 Peter Stephenson <pws@csr.com> + + * 22427: Doc/Zsh/zle.yo, Src/Zle/zle_thingy.c: zle <widget> -w + sets WIDGET etc. to reflect <widget>. + 2006-04-24 Peter Stephenson <p.w.stephenson@ntlworld.com> * zsh-users/10172: Doc/Zsh/zle.yo, Src/Zle/iwidgets.list, diff --git a/Doc/Zsh/zle.yo b/Doc/Zsh/zle.yo index d6c8c773f..d2c844017 100644 --- a/Doc/Zsh/zle.yo +++ b/Doc/Zsh/zle.yo @@ -338,7 +338,7 @@ xitem(tt(zle) tt(-U) var(string)) xitem(tt(zle) tt(-K) var(keymap)) xitem(tt(zle) tt(-F) [ tt(-L) ] [ var(fd) [ var(handler) ] ]) xitem(tt(zle) tt(-I)) -item(tt(zle) var(widget) tt([ -n) var(num) tt(]) tt([ -N ] [ -K) var(keymap) tt(]) var(args) ...)( +item(tt(zle) var(widget) tt([ -n) var(num) tt(]) tt([ -Nw ] [ -K) var(keymap) tt(]) var(args) ...)( The tt(zle) builtin performs a number of different actions concerning ZLE. @@ -535,7 +535,7 @@ this may have been by a previous call to `tt(zle -I)' or by a system notification. To test if a zle widget may be called at this point, execute tt(zle) with no arguments and examine the return status. ) -item(var(widget) tt([ -n) var(num) tt(]) tt([ -N ] [ -K) var(keymap) tt(]) var(args) ...)( +item(var(widget) tt([ -n) var(num) tt(]) tt([ -Nw ] [ -K) var(keymap) tt(]) var(args) ...)( Invoke the specified widget. This can only be done when ZLE is active; normally this will be within a user-defined widget. @@ -548,6 +548,12 @@ With the option tt(-K), var(keymap) will be used as the current keymap during the execution of the widget. The previous keymap will be restored when the widget exits. +Normally, calling a widget in this way does not set the special +parameter tt(WIDGET) and related parameters, so that the environment +appears as if the top-level widget called by the user were still +active. With the option tt(-w), tt(WIDGET) and related parameters are set +to reflect the widget being executed by the tt(zle) call. + Any further arguments will be passed to the widget. If it is a shell function, these are passed down as positional parameters; for builtin widgets it is up to the widget in question what it does with them. @@ -559,7 +565,7 @@ them. The return status reflects the success or failure of the operation carried out by the widget, or if it is a user-defined widget the return status of -the shell function. +the shell function. A non-zero return status causes the shell to beep when the widget exits, unless the tt(BEEP) options was unset or the widget was called via the diff --git a/Src/Zle/zle_thingy.c b/Src/Zle/zle_thingy.c index c0c8622b2..209949df2 100644 --- a/Src/Zle/zle_thingy.c +++ b/Src/Zle/zle_thingy.c @@ -639,9 +639,9 @@ zle_usable() static int bin_zle_call(char *name, char **args, UNUSED(Options ops), UNUSED(char func)) { - Thingy t; + Thingy t, savbindk = bindk; struct modifier modsave = zmod; - int ret, saveflag = 0; + int ret, saveflag = 0, setbindk = 0; char *wname = *args++, *keymap_restore = NULL, *keymap_tmp; if (!wname) @@ -692,6 +692,9 @@ bin_zle_call(char *name, char **args, UNUSED(Options ops), UNUSED(char func)) if (selectkeymap(keymap_tmp, 0)) return 1; break; + case 'w': + setbindk = 1; + break; default: zwarnnam(name, "unknown option: %s", *args, 0); return 1; @@ -701,7 +704,10 @@ 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; unrefthingy(t); if (saveflag) zmod = modsave; |