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

For left aligned segments start the foreground color after the visual

identifier has been printed.
This commit is contained in:
Dominik Ritter 2015-12-15 01:21:15 +01:00
parent c5726bc548
commit 6f7d6f7259

View file

@ -142,7 +142,7 @@ left_prompt_segment() {
[[ -n $3 ]] && fg="%F{$3}" || fg="%f" [[ -n $3 ]] && fg="%F{$3}" || fg="%f"
if [[ $CURRENT_BG != 'NONE' ]] && ! isSameColor "$2" "$CURRENT_BG"; then if [[ $CURRENT_BG != 'NONE' ]] && ! isSameColor "$2" "$CURRENT_BG"; then
# Middle segment # Middle segment
echo -n "%{$bg%F{$CURRENT_BG}%}$(print_icon 'LEFT_SEGMENT_SEPARATOR')%{$fg%}$POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS" echo -n "%{$bg%F{$CURRENT_BG}%}$(print_icon 'LEFT_SEGMENT_SEPARATOR')$POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS"
elif isSameColor "$CURRENT_BG" "$2"; then elif isSameColor "$CURRENT_BG" "$2"; then
# Middle segment with same color as previous segment # Middle segment with same color as previous segment
# We take the current foreground color as color for our # We take the current foreground color as color for our
@ -150,10 +150,10 @@ left_prompt_segment() {
# enough contrast. # enough contrast.
local complement local complement
[[ -n $3 ]] && complement=$3 || complement=$DEFAULT_COLOR [[ -n $3 ]] && complement=$3 || complement=$DEFAULT_COLOR
echo -n "%{$bg%F{$complement}%}$(print_icon 'LEFT_SUBSEGMENT_SEPARATOR')%{$fg%}$POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS" echo -n "%{$bg%F{$complement}%}$(print_icon 'LEFT_SUBSEGMENT_SEPARATOR')$POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS"
else else
# First segment # First segment
echo -n "%{$bg%}%{$fg%}$POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS" echo -n "%{$bg%}$POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS"
fi fi
local visual_identifier local visual_identifier
@ -167,7 +167,7 @@ left_prompt_segment() {
[[ -n $4 ]] && visual_identifier="$visual_identifier " [[ -n $4 ]] && visual_identifier="$visual_identifier "
fi fi
echo -n "$visual_identifier$4$POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS" echo -n "$visual_identifier%{$fg%}$4$POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS"
CURRENT_BG=$2 CURRENT_BG=$2
} }