diff options
author | romkatv <roman.perepelitsa@gmail.com> | 2019-06-19 16:56:22 +0300 |
---|---|---|
committer | romkatv <roman.perepelitsa@gmail.com> | 2019-06-19 17:01:44 +0300 |
commit | 088502c30c50c6f21e8a46fc1b057ab80fcd0963 (patch) | |
tree | c33d67b51e047ed3b388c84c1609b0f14d141bbd /internal | |
parent | 5f40c44940edc5278cbe089e42bfeaff1acedb72 (diff) |
fix _get_icon on ZSH 5.1
ZSH 5.1 has crippled ${(P)...}. For example, the following code prints "broken":
unset foo
echo ${${(P)foo}+broken}
In ZSH 5.2 and later this code print an empty line.
Fixes #91.
Diffstat (limited to 'internal')
-rwxr-xr-x | internal/p10k.zsh | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/internal/p10k.zsh b/internal/p10k.zsh index 4366628d..3d499c73 100755 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -77,8 +77,9 @@ _p9k_cache_get() { # Sets _P9K_RETVAL to the icon whose name is supplied via $1. _p9k_get_icon() { - local var_name=POWERLEVEL9K_$1 - _P9K_RETVAL=${(g::)${${(P)var_name}-$icons[$1]}} + local x=POWERLEVEL9K_$1 + (( $+parameters[$x] )) && x=${(P)x} || x=$icons[$1] + _P9K_RETVAL=${(g::)x} [[ $_P9K_RETVAL != $'\b'? ]] || _P9K_RETVAL="%{$_P9K_RETVAL%}" # penance for past sins } |