optimize codegen when VISUAL_IDENTIFIER_EXPANSION doesn't contain $-expansions

pull/145/head
romkatv 5 years ago
parent c5e24d843b
commit 8b04966624

@ -317,9 +317,11 @@ left_prompt_segment() {
_p9k_param $1 CONTENT_EXPANSION '${P9K_CONTENT}' _p9k_param $1 CONTENT_EXPANSION '${P9K_CONTENT}'
local content_exp=$_P9K_RETVAL local content_exp=$_P9K_RETVAL
if [[ $icon_exp == '${P9K_VISUAL_IDENTIFIER}' && $content_exp == '${P9K_CONTENT}' ]]; then if [[ ( $icon_exp == '${P9K_VISUAL_IDENTIFIER}' || $icon_exp != *'$'* ) &&
p+="\${_P9K_V::=$icon_" ( $content_exp == '${P9K_CONTENT}' || $content_exp != *'$'* ) ]]; then
[[ $icon_ == *%* ]] && p+=$style_ [[ $icon_exp == '${P9K_VISUAL_IDENTIFIER}' ]] && _P9K_RETVAL=$icon_ || _p9k_escape $icon_exp
p+="\${_P9K_V::=$_P9K_RETVAL"
[[ $_P9K_RETVAL == *%* ]] && p+=$style_
p+="}" p+="}"
else else
p+="\${P9K_VISUAL_IDENTIFIER::=$icon_}\${_P9K_V::=$icon_exp$style_}" p+="\${P9K_VISUAL_IDENTIFIER::=$icon_}\${_P9K_V::=$icon_exp$style_}"
@ -469,9 +471,11 @@ right_prompt_segment() {
_p9k_param $1 CONTENT_EXPANSION '${P9K_CONTENT}' _p9k_param $1 CONTENT_EXPANSION '${P9K_CONTENT}'
local content_exp=$_P9K_RETVAL local content_exp=$_P9K_RETVAL
if [[ $icon_exp == '${P9K_VISUAL_IDENTIFIER}' && $content_exp == '${P9K_CONTENT}' ]]; then if [[ ( $icon_exp == '${P9K_VISUAL_IDENTIFIER}' || $icon_exp != *'$'* ) &&
p+="\${_P9K_V::=$icon_" ( $content_exp == '${P9K_CONTENT}' || $content_exp != *'$'* ) ]]; then
[[ $icon_ == *%* ]] && p+=$style_ [[ $icon_exp == '${P9K_VISUAL_IDENTIFIER}' ]] && _P9K_RETVAL=$icon_ || _p9k_escape $icon_exp
p+="\${_P9K_V::=$_P9K_RETVAL"
[[ $_P9K_RETVAL == *%* ]] && p+=$style_
p+="}" p+="}"
else else
p+="\${P9K_VISUAL_IDENTIFIER::=$icon_}\${_P9K_V::=$icon_exp$style_}" p+="\${P9K_VISUAL_IDENTIFIER::=$icon_}\${_P9K_V::=$icon_exp$style_}"

Loading…
Cancel
Save