mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-11-12 08:10:07 +00:00
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.
This commit is contained in:
parent
5f40c44940
commit
088502c30c
1 changed files with 3 additions and 2 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue