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:
parent
4849ef3307
commit
7e7e291b20
|
@ -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 ;;
|
||||
|
|
Loading…
Reference in New Issue