1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-12-23 23:51:58 +00:00

work around a bug in zsh that percent-expands %1F{2} as if it was %F{2}; fixes #270

This commit is contained in:
romkatv 2019-10-19 07:40:27 +02:00
parent 94de8519b4
commit f2cd89ed70

View file

@ -91,7 +91,7 @@ function getColorCode() {
emulate -L zsh
setopt no_hist_expand extended_glob no_prompt_bang prompt_{percent,subst}
if (( ARGC == 1 )); then
case $1 in
case $1 in
foreground)
local k
for k in "${(k@)__p9k_colors}"; do
@ -444,11 +444,10 @@ _p9k_background() {
}
_p9k_foreground() {
case $1 in
'') _p9k_ret="%f";;
'#'*) _p9k_ret="%F{$1}";;
*) _p9k_ret="%${1}F";;
esac
# Note: This code used to produce `%1F` instead of `%F{1}` because it's more efficient.
# Unfortunately, this triggers a bug in zsh. Namely, `%1F{2}` gets percent-expanded as if
# it was `%F{2}`.
[[ -n $1 ]] && _p9k_ret="%F{$1}" || _p9k_ret="%k"
}
_p9k_escape_style() {