Little bit cleaner method of calling add-zle-hook-widget with no_unset.

This commit is contained in:
Paul Ackersviller 2016-12-24 15:59:40 -05:00
parent b68c2701d0
commit ac0b03f59a

View File

@ -308,16 +308,13 @@ then
} }
_zsh_highlight_bind_widgets(){} _zsh_highlight_bind_widgets(){}
local prevunsetstate= # This is for 5.3 before about 5.3.2, or whenever add-zle-hook-widget
[[ -o unset ]] || prevunsetstate=NO_ # in zsh source is modified to work with nounset in the calling scope.
setopt localoptions UNSET # for following two add-zle-hook-widget calls... () {
# TODO: figure out why only 5.3 with no_unset gives following error setopt localoptions UNSET
# add-zle-hook-widget:84: widgets[$hook]: parameter not set
add-zle-hook-widget zle-line-pre-redraw _zsh_highlight add-zle-hook-widget zle-line-pre-redraw _zsh_highlight
add-zle-hook-widget zle-line-finish _zsh_highlight__zle-line-finish add-zle-hook-widget zle-line-finish _zsh_highlight__zle-line-finish
}
setopt ${prevunsetstate}UNSET # put back as before
else else
# Rebind all ZLE widgets to make them invoke _zsh_highlights. # Rebind all ZLE widgets to make them invoke _zsh_highlights.
_zsh_highlight_bind_widgets() _zsh_highlight_bind_widgets()