1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-27 04:40:59 +01:00

39495: add-zle-hook-widget: Add end-of-options guard to hook invocation.

Currently, the only special widget that takes arguments is zle-keymap-select.
This commit is contained in:
Daniel Shahaf 2016-09-29 09:50:09 +00:00
parent dfc9214984
commit 4f2a1810f2
3 changed files with 6 additions and 3 deletions

View file

@ -1,5 +1,8 @@
2016-09-30 Daniel Shahaf <d.s@daniel.shahaf.name> 2016-09-30 Daniel Shahaf <d.s@daniel.shahaf.name>
* 39495: Doc/Zsh/contrib.yo, Functions/Misc/add-zle-hook-widget:
add-zle-hook-widget: Add end-of-options guard to hook invocation.
* 39480: Completion/Debian/Command/_bug: _reportbug: Complete * 39480: Completion/Debian/Command/_bug: _reportbug: Complete
absolute filenames, too. absolute filenames, too.

View file

@ -346,7 +346,7 @@ as the var(hook) argument.
var(widgetname) is the name of a ZLE widget. If no options are given this var(widgetname) is the name of a ZLE widget. If no options are given this
is added to the array of widgets to be invoked in the given hook context. is added to the array of widgets to be invoked in the given hook context.
Note that the hooks are called as widgets, that is, with Note that the hooks are called as widgets, that is, with
example(tt(zle )var(widgetname)tt( -Nw "$@")) example(tt(zle )var(widgetname)tt( -Nw -- "$@"))
vindex(WIDGET, in hooks) vindex(WIDGET, in hooks)
Note that this means that the `tt(WIDGET)' special parameter tracks the Note that this means that the `tt(WIDGET)' special parameter tracks the

View file

@ -47,9 +47,9 @@ function azhw:${^hooktypes} {
for hook in "${(@)${(@on)hook_widgets[@]}#<->:}"; do for hook in "${(@)${(@on)hook_widgets[@]}#<->:}"; do
if [[ "$hook" = user:* ]]; then if [[ "$hook" = user:* ]]; then
# Preserve $WIDGET within the renamed widget # Preserve $WIDGET within the renamed widget
zle "$hook" -N "$@" zle "$hook" -N -- "$@"
else else
zle "$hook" -Nw "$@" zle "$hook" -Nw -- "$@"
fi || return fi || return
done done
return 0 return 0