1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-11-29 14:50:08 +00:00

Only check for a user defined variable if we really have an visual

identifier.
This commit is contained in:
Dominik Ritter 2015-12-15 02:43:42 +01:00
parent 409303f45d
commit 056d4ff29a

View file

@ -159,6 +159,7 @@ left_prompt_segment() {
local visual_identifier local visual_identifier
if [[ -n $5 ]]; then if [[ -n $5 ]]; then
visual_identifier="$(print_icon $5)" visual_identifier="$(print_icon $5)"
if [[ -n "$visual_identifier" ]]; then
# Allow users to overwrite the color for the visual identifier only. # Allow users to overwrite the color for the visual identifier only.
local visual_identifier_color_variable=POWERLEVEL9K_${(U)1#prompt_}_VISUAL_IDENTIFIER_COLOR local visual_identifier_color_variable=POWERLEVEL9K_${(U)1#prompt_}_VISUAL_IDENTIFIER_COLOR
set_default $visual_identifier_color_variable $3 set_default $visual_identifier_color_variable $3
@ -166,6 +167,7 @@ left_prompt_segment() {
# Add an whitespace if we print more than just the visual identifier # Add an whitespace if we print more than just the visual identifier
[[ -n $4 ]] && visual_identifier="$visual_identifier " [[ -n $4 ]] && visual_identifier="$visual_identifier "
fi fi
fi
echo -n "$visual_identifier%{$fg%}$4$POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS" echo -n "$visual_identifier%{$fg%}$4$POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS"
CURRENT_BG=$2 CURRENT_BG=$2
@ -224,6 +226,7 @@ right_prompt_segment() {
local visual_identifier local visual_identifier
if [[ -n $5 ]]; then if [[ -n $5 ]]; then
visual_identifier="$(print_icon $5)" visual_identifier="$(print_icon $5)"
if [[ -n "$visual_identifier" ]]; then
# Allow users to overwrite the color for the visual identifier only. # Allow users to overwrite the color for the visual identifier only.
local visual_identifier_color_variable=POWERLEVEL9K_${(U)1#prompt_}_VISUAL_IDENTIFIER_COLOR local visual_identifier_color_variable=POWERLEVEL9K_${(U)1#prompt_}_VISUAL_IDENTIFIER_COLOR
set_default $visual_identifier_color_variable $3 set_default $visual_identifier_color_variable $3
@ -231,6 +234,7 @@ right_prompt_segment() {
# Add an whitespace if we print more than just the visual identifier # Add an whitespace if we print more than just the visual identifier
[[ -n $4 ]] && visual_identifier=" $visual_identifier" [[ -n $4 ]] && visual_identifier=" $visual_identifier"
fi fi
fi
echo -n "$4$visual_identifier$POWERLEVEL9K_WHITESPACE_BETWEEN_RIGHT_SEGMENTS%f" echo -n "$4$visual_identifier$POWERLEVEL9K_WHITESPACE_BETWEEN_RIGHT_SEGMENTS%f"
CURRENT_RIGHT_BG=$2 CURRENT_RIGHT_BG=$2