diff options
author | Axel Beckert <abe@deuxchevaux.org> | 2018-12-24 04:40:22 +0100 |
---|---|---|
committer | Axel Beckert <abe@deuxchevaux.org> | 2018-12-24 04:40:22 +0100 |
commit | bf8b7f713a5b04a191f4596fb86bbbfca0a855ce (patch) | |
tree | b647a8dc990c8c845b8a8eca7bf92fbbf17e1fb5 /Functions/Misc | |
parent | 06946d431a4426c6e5dffec1d7edb17c1dbd467c (diff) | |
parent | 9dbde9e9c7d22ee0d301e4a2fecf97906d1ddce9 (diff) | |
download | zsh-bf8b7f713a5b04a191f4596fb86bbbfca0a855ce.tar.gz zsh-bf8b7f713a5b04a191f4596fb86bbbfca0a855ce.zip |
New upstream release candidate 5.6.2-test-2
Merge branch 'upstream' at 'zsh-5.6.2-test-2' into branch debian
Diffstat (limited to 'Functions/Misc')
-rw-r--r-- | Functions/Misc/add-zle-hook-widget | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Functions/Misc/add-zle-hook-widget b/Functions/Misc/add-zle-hook-widget index d8a3950fb..9cc35496f 100644 --- a/Functions/Misc/add-zle-hook-widget +++ b/Functions/Misc/add-zle-hook-widget @@ -129,7 +129,7 @@ function add-zle-hook-widget { else # Check whether attempting to add a widget named for the hook if [[ "$fn" = "$hook" ]]; then - if [[ -n "${widgets[$fn]}" ]]; then + if (( ${+widgets[$fn]} )); then print -u2 "$funcstack[1]: Cannot hook $fn to itself" return 1 fi @@ -141,8 +141,8 @@ function add-zle-hook-widget { integer i=${#options[ksharrays]}-2 zstyle -g extant_hooks "$hook" widgets # Check for an existing widget, add it as the first hook - if [[ ${widgets[$hook]} != "user:azhw:$hook" ]]; then - if [[ -n ${widgets[$hook]} ]]; then + if [[ ${widgets[$hook]:-} != "user:azhw:$hook" ]]; then + if [[ -n ${widgets[$hook]:-} ]]; then zle -A "$hook" "${widgets[$hook]}" extant_hooks=(0:"${widgets[$hook]}" "${extant_hooks[@]}") fi @@ -152,17 +152,17 @@ function add-zle-hook-widget { if [[ -z ${(M)extant_hooks[@]:#(<->:|)$fn} ]]; then # no index and not already hooked # assign largest existing index plus 1 - i=${${(On@)${(@M)extant_hooks[@]#<->:}%:}[i]}+1 + i=${${(On@)${(@M)extant_hooks[@]#<->:}%:}[i]:-0}+1 else return 0 fi extant_hooks+=("${i}:${fn}") zstyle -- "$hook" widgets "${extant_hooks[@]}" - if [[ -z "${widgets[$fn]}" ]]; then + if (( ! ${+widgets[$fn]} )); then autoload "${autoopts[@]}" -- "$fn" zle -N -- "$fn" fi - if [[ -z "${widgets[$hook]}" ]]; then + if (( ! ${+widgets[$hook]} )); then zle -N "$hook" azhw:"$hook" fi fi |