aboutsummaryrefslogtreecommitdiff
path: root/internal/p10k.zsh
diff options
context:
space:
mode:
authorRoman Perepelitsa <roman.perepelitsa@gmail.com>2021-01-26 14:43:07 +0300
committerRoman Perepelitsa <roman.perepelitsa@gmail.com>2021-01-26 14:43:07 +0300
commitb816abfed0e8785d8bc2e47987cc40f6bcd4bc29 (patch)
treee1a14cf84952955be57101aeff33086101780380 /internal/p10k.zsh
parentd26bdcd6010cfe82bc7bab07e4363b40be834cc8 (diff)
work around bugs in add-zle-hook-widget (#1238)
Diffstat (limited to 'internal/p10k.zsh')
-rw-r--r--internal/p10k.zsh12
1 files changed, 9 insertions, 3 deletions
diff --git a/internal/p10k.zsh b/internal/p10k.zsh
index c63564d8..9dffb547 100644
--- a/internal/p10k.zsh
+++ b/internal/p10k.zsh
@@ -7584,9 +7584,15 @@ function _p9k_wrap_widgets() {
if (( ! $+functions[_p9k_widget_$widget] )); then
functions[_p9k_widget_$widget]='_p9k_widget '${(q)widget}' "$@"'
fi
- # The leading dot is to work around bugs in zsh-syntax-highlighting.
- zle -A $widget ._p9k_orig_$widget
- zle -N $widget _p9k_widget_$widget
+ if [[ $widget == zle-* &&
+ $widgets[$widget] == user:azhw:* &&
+ $functions[add-zle-hook-widget] ]]; then
+ add-zle-hook-widget $widget _p9k_widget_$widget
+ else
+ # The leading dot is to work around bugs in zsh-syntax-highlighting.
+ zle -A $widget ._p9k_orig_$widget
+ zle -N $widget _p9k_widget_$widget
+ fi
done 2>/dev/null # `zle -A` fails for inexisting widgets and complains to stderr
}