1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-11-24 13:10:07 +00:00

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.
This commit is contained in:
Alex Jurkiewicz 2023-10-12 14:10:35 +08:00
parent fe9b9f9c3e
commit 893e130bd1

View file

@ -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"
;;
*)