Fix case when widget was defined with `zle -N widget`

Fixes #774
This commit is contained in:
ZyX 2014-01-30 00:42:56 +04:00
parent b1e81707c1
commit dc33c36098
1 changed files with 3 additions and 0 deletions

View File

@ -76,6 +76,9 @@ _powerline_add_widget() {
save_widget="${save_widget}_$i" save_widget="${save_widget}_$i"
(( i++ )) (( i++ ))
done done
# If widget was defined with `zle -N widget` (without `function`
# argument) then this function will be handy.
eval "function $save_widget() { emulate -L zsh; $widget \$@ }"
eval "${old_widget_command/$widget/$save_widget}" eval "${old_widget_command/$widget/$save_widget}"
zle -N $widget $function zle -N $widget $function
export POWERLINE_SAVE_WIDGET="$save_widget" export POWERLINE_SAVE_WIDGET="$save_widget"