From b816abfed0e8785d8bc2e47987cc40f6bcd4bc29 Mon Sep 17 00:00:00 2001 From: Roman Perepelitsa Date: Tue, 26 Jan 2021 12:43:07 +0100 Subject: [PATCH] work around bugs in add-zle-hook-widget (#1238) --- internal/p10k.zsh | 12 +++++++++--- 1 file 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 }