widget binding: Unbreak the build.

The last commit inadvertently broke interactive use, although the test suite passed.

See issue #278.
This commit is contained in:
Daniel Shahaf 2016-03-18 14:41:18 +00:00
parent 7e7e291b20
commit 261c180a36

View File

@ -222,18 +222,21 @@ _zsh_highlight_bind_widgets()
# Already rebound event: do nothing.
user:_zsh_highlight_widget_*);;
# The "eval"'s are required to make $cur_widget a closure: the value of the parameter at function
# definition time is used.
# User defined widget: override and rebind old one with prefix "orig-".
user:*) zle -N orig-$cur_widget ${widgets[$cur_widget]#*:}
_zsh_highlight_widget_$cur_widget() { _zsh_highlight_call_widget orig-$cur_widget -- "$@" };
eval "_zsh_highlight_widget_$cur_widget() { _zsh_highlight_call_widget orig-$cur_widget -- \"\$@\" }";
zle -N $cur_widget _zsh_highlight_widget_$cur_widget;;
# Completion widget: override and rebind old one with prefix "orig-".
completion:*) zle -C orig-$cur_widget ${${widgets[$cur_widget]#*:}/:/ }; \
_zsh_highlight_widget_$cur_widget() { _zsh_highlight_call_widget orig-$cur_widget -- "$@" }; \
eval "_zsh_highlight_widget_$cur_widget() { _zsh_highlight_call_widget orig-$cur_widget -- \"\$@\" }"; \
zle -N $cur_widget _zsh_highlight_widget_$cur_widget;;
# Builtin widget: override and make it call the builtin ".widget".
builtin) _zsh_highlight_widget_$cur_widget() { _zsh_highlight_call_widget .$cur_widget -- "$@" }; \
builtin) eval "_zsh_highlight_widget_$cur_widget() { _zsh_highlight_call_widget .$cur_widget -- \"\$@\" }";
zle -N $cur_widget _zsh_highlight_widget_$cur_widget;;
# Default: unhandled case.