From 893e130bd112159a817818af6210094cc12095b1 Mon Sep 17 00:00:00 2001 From: Alex Jurkiewicz Date: Thu, 12 Oct 2023 14:10:35 +0800 Subject: [PATCH] Fix POWERLEVEL9K_VIRTUALENV_SHOW_WITH_PYENV=if-different (I think) We were comparing virtualenv's name to pyenv's version, which would never be the same. Now this setting works as intended, although I'm not sure how useful it is. It's probably more useful to reorder this logic so virtualenv has precedence. --- internal/p10k.zsh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/p10k.zsh b/internal/p10k.zsh index 95227018..a54ce85c 100644 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -4304,8 +4304,10 @@ _virtualenv_load_name_poetry() { } prompt_virtualenv() { local msg='' + local version='' if (( _POWERLEVEL9K_VIRTUALENV_SHOW_PYTHON_VERSION )) && _p9k_python_version; then - msg="${_p9k__ret//\%/%%} " + version="${_p9k__ret//\%/%%}" + msg="$version " fi _virtualenv_name='' if [[ -n $VIRTUAL_ENV ]]; then @@ -4324,7 +4326,7 @@ prompt_virtualenv() { _p9k_prompt_segment "$0" "blue" "$_p9k_color1" 'PYTHON_ICON' 0 '${(M)${#P9K_PYENV_PYTHON_VERSION}:#0}' "$msg" ;; if-different) - _p9k_escape $_virtualenv_name + _p9k_escape $version _p9k_prompt_segment "$0" "blue" "$_p9k_color1" 'PYTHON_ICON' 0 '${${:-'$_p9k__ret'}:#$_p9k__pyenv_version}' "$msg" ;; *)