From a8db401808f6daf16710118bd7fb37f6b30b261a Mon Sep 17 00:00:00 2001 From: Ymage Date: Thu, 3 Jan 2019 12:07:27 +0100 Subject: [PATCH 1/3] [Bugfix] virtualenv prompt displaying Fix #1127 --- powerlevel9k.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 79237385..7077bfc8 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -1648,7 +1648,7 @@ prompt_vi_mode() { # https://virtualenv.pypa.io/en/latest/ prompt_virtualenv() { local virtualenv_path="$VIRTUAL_ENV" - if [[ -n "$virtualenv_path" && -z "$VIRTUAL_ENV_DISABLE_PROMPT" ]]; then + if [[ -n "$virtualenv_path" && "$VIRTUAL_ENV_DISABLE_PROMPT" != true ]]; then "$1_prompt_segment" "$0" "$2" "blue" "$DEFAULT_COLOR" "$(basename "$virtualenv_path")" 'PYTHON_ICON' fi } From 12e972486055dbb37279ef81ae4d2114e8221f19 Mon Sep 17 00:00:00 2001 From: Ymage Date: Mon, 7 Jan 2019 09:18:34 +0100 Subject: [PATCH 2/3] Merge with @dritter proposal --- powerlevel9k.zsh-theme | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 7077bfc8..472dd949 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -1648,7 +1648,12 @@ prompt_vi_mode() { # https://virtualenv.pypa.io/en/latest/ prompt_virtualenv() { local virtualenv_path="$VIRTUAL_ENV" - if [[ -n "$virtualenv_path" && "$VIRTUAL_ENV_DISABLE_PROMPT" != true ]]; then + + # Early exit; $virtualenv_path must always be set. + [[ -z "$virtualenv_path" ]] && return + + # Check if VIRTUAL_ENV_DISABLE_PROMPT is set to false, or is a numerical value + if [[ "$VIRTUAL_ENV_DISABLE_PROMPT" == "false" ]] || (( VIRTUAL_ENV_DISABLE_PROMPT )); then "$1_prompt_segment" "$0" "$2" "blue" "$DEFAULT_COLOR" "$(basename "$virtualenv_path")" 'PYTHON_ICON' fi } From ee7416962d80dfaaed7efd57511d5aa568480d21 Mon Sep 17 00:00:00 2001 From: Ymage Date: Wed, 9 Jan 2019 17:00:05 +0100 Subject: [PATCH 3/3] Remove $VIRTUAL_ENV_DISABLE_PROMPT testing --- powerlevel9k.zsh-theme | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 472dd949..60c16b5a 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -1652,10 +1652,7 @@ prompt_virtualenv() { # Early exit; $virtualenv_path must always be set. [[ -z "$virtualenv_path" ]] && return - # Check if VIRTUAL_ENV_DISABLE_PROMPT is set to false, or is a numerical value - if [[ "$VIRTUAL_ENV_DISABLE_PROMPT" == "false" ]] || (( VIRTUAL_ENV_DISABLE_PROMPT )); then - "$1_prompt_segment" "$0" "$2" "blue" "$DEFAULT_COLOR" "$(basename "$virtualenv_path")" 'PYTHON_ICON' - fi + "$1_prompt_segment" "$0" "$2" "blue" "$DEFAULT_COLOR" "$(basename "$virtualenv_path")" 'PYTHON_ICON' } ################################################################