widget binding: Remove an unnecessary layer of indirection.

The 'eval' was never needed, and the lack of proper quoting of the interpolated
variables caused issues, such as #278.

Fixes zsh-users/zsh-syntax-highlighting#278.
This commit is contained in:
Daniel Shahaf 2016-03-18 13:58:55 +00:00
parent 4849ef3307
commit 7e7e291b20

View File

@ -223,18 +223,18 @@ _zsh_highlight_bind_widgets()
user:_zsh_highlight_widget_*);;
# User defined widget: override and rebind old one with prefix "orig-".
user:*) eval "zle -N orig-$cur_widget ${widgets[$cur_widget]#*:}; \
_zsh_highlight_widget_$cur_widget() { _zsh_highlight_call_widget orig-$cur_widget -- \"\$@\" }; \
zle -N $cur_widget _zsh_highlight_widget_$cur_widget";;
user:*) zle -N orig-$cur_widget ${widgets[$cur_widget]#*:}
_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:*) eval "zle -C orig-$cur_widget ${${widgets[$cur_widget]#*:}/:/ }; \
_zsh_highlight_widget_$cur_widget() { _zsh_highlight_call_widget orig-$cur_widget -- \"\$@\" }; \
zle -N $cur_widget _zsh_highlight_widget_$cur_widget";;
completion:*) zle -C orig-$cur_widget ${${widgets[$cur_widget]#*:}/:/ }; \
_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) eval "_zsh_highlight_widget_$cur_widget() { _zsh_highlight_call_widget .$cur_widget -- \"\$@\" }; \
zle -N $cur_widget _zsh_highlight_widget_$cur_widget";;
builtin) _zsh_highlight_widget_$cur_widget() { _zsh_highlight_call_widget .$cur_widget -- "$@" }; \
zle -N $cur_widget _zsh_highlight_widget_$cur_widget;;
# Default: unhandled case.
*) echo "zsh-syntax-highlighting: unhandled ZLE widget '$cur_widget'" >&2 ;;