From f2772bd56fdafaf0842a0cb6dddd51a3a0c8bb7d Mon Sep 17 00:00:00 2001 From: Alex Jurkiewicz Date: Thu, 12 Oct 2023 14:38:08 +0800 Subject: [PATCH] virtualenv: Handle not being in a virtualenv Pre-Poetry support, we only entered this codepath when we were inside a virtualenv. Now we enter it for every directory, but we don't want to display an empty segment for non-virtualenv locations. --- internal/p10k.zsh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/p10k.zsh b/internal/p10k.zsh index 956f1340..a76305fe 100644 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -4320,6 +4320,10 @@ prompt_virtualenv() { _virtualenv_load_name_poetry $idx fi fi + # Display nothing if there's no active virtualenv + if [[ -z $_virtualenv_name ]]; then + return + fi msg+="$_POWERLEVEL9K_VIRTUALENV_LEFT_DELIMITER${_virtualenv_name//\%/%%}$_POWERLEVEL9K_VIRTUALENV_RIGHT_DELIMITER" case $_POWERLEVEL9K_VIRTUALENV_SHOW_WITH_PYENV in false)