1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-12-19 14:01:57 +00:00
This commit is contained in:
romkatv 2019-03-10 20:09:37 +01:00
parent c3717bac6c
commit 0aa667dbf8

View file

@ -236,25 +236,24 @@ left_prompt_segment() {
_p9k_get_icon LEFT_SUBSEGMENT_SEPARATOR _p9k_get_icon LEFT_SUBSEGMENT_SEPARATOR
output+="${_P9K_RETVAL}${POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS}" output+="${_P9K_RETVAL}${POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS}"
else else
_p9k_foreground $_P9K_CURRENT_BG output+="%F{$_P9K_CURRENT_BG}"
output+=$_P9K_RETVAL
_p9k_get_icon LEFT_SEGMENT_SEPARATOR _p9k_get_icon LEFT_SEGMENT_SEPARATOR
output+="${_P9K_RETVAL}${POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS}" output+="${_P9K_RETVAL}${POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS}"
fi fi
fi fi
if [[ -n $6 ]]; then if [[ -n $6 ]]; then
_p9k_get_icon $6 _p9k_get_icon $6
if [[ -n $_P9K_RETVAL ]]; then if [[ -n $_P9K_RETVAL ]]; then
local icon=$_P9K_RETVAL local icon=$_P9K_RETVAL
_p9k_foreground $foreground_color $1 VISUAL_IDENTIFIER_COLOR _p9k_color $foreground_color $1 VISUAL_IDENTIFIER_COLOR
_p9k_foreground $_P9K_RETVAL
# Add an whitespace if we print more than just the visual identifier. # Add an whitespace if we print more than just the visual identifier.
# To avoid cutting off the visual identifier in some terminal emulators (e.g., Konsole, st), # To avoid cutting off the visual identifier in some terminal emulators (e.g., Konsole, st),
# we need to color both the visual identifier and the whitespace. # we need to color both the visual identifier and the whitespace.
output+="${_P9K_RETVAL}${icon}${5:+ }" output+="${_P9K_RETVAL}${icon}${5:+ }"
fi fi
fi fi
output+=$foreground output+=$foreground
_p9k_cache_set "$output" "$background_color" _p9k_cache_set "$output" "$background_color"
fi fi
@ -322,8 +321,7 @@ right_prompt_segment() {
_p9k_get_icon RIGHT_SUBSEGMENT_SEPARATOR _p9k_get_icon RIGHT_SUBSEGMENT_SEPARATOR
output+=$_P9K_RETVAL output+=$_P9K_RETVAL
else else
_p9k_foreground $background_color output+="%F{$background_color}"
output+=$_P9K_RETVAL
_p9k_get_icon RIGHT_SEGMENT_SEPARATOR _p9k_get_icon RIGHT_SEGMENT_SEPARATOR
output+=$_P9K_RETVAL output+=$_P9K_RETVAL
fi fi
@ -339,7 +337,8 @@ right_prompt_segment() {
_p9k_get_icon $6 _p9k_get_icon $6
if [[ -n $_P9K_RETVAL ]]; then if [[ -n $_P9K_RETVAL ]]; then
local icon=$_P9K_RETVAL local icon=$_P9K_RETVAL
_p9k_foreground $foreground_color $1 VISUAL_IDENTIFIER_COLOR _p9k_color $foreground_color $1 VISUAL_IDENTIFIER_COLOR
_p9k_foreground $_P9K_RETVAL
# Add an whitespace if we print more than just the visual identifier. # Add an whitespace if we print more than just the visual identifier.
# To avoid cutting off the visual identifier in some terminal emulators (e.g., Konsole, st), # To avoid cutting off the visual identifier in some terminal emulators (e.g., Konsole, st),
# we need to color both the visual identifier and the whitespace. # we need to color both the visual identifier and the whitespace.
@ -1554,7 +1553,7 @@ build_test_stats() {
# System time # System time
prompt_time() { prompt_time() {
set_default POWERLEVEL9K_TIME_FORMAT "%D{%H:%M:%S}" set_default POWERLEVEL9K_TIME_FORMAT "%D{%H:%M:%S}"
[[ -v _P9K_REFRESH_PROMPT ]] || typeset -gH _P9K_TIME=${(%)POWERLEVEL9K_TIME_FORMAT} [[ -v _P9K_REFRESH_PROMPT ]] || typeset -gH _P9K_TIME=$(print -P $POWERLEVEL9K_TIME_FORMAT)
"$1_prompt_segment" "$0" "$2" "$DEFAULT_COLOR_INVERTED" "$DEFAULT_COLOR" "$_P9K_TIME" "TIME_ICON" "$1_prompt_segment" "$0" "$2" "$DEFAULT_COLOR_INVERTED" "$DEFAULT_COLOR" "$_P9K_TIME" "TIME_ICON"
} }
@ -1562,7 +1561,7 @@ prompt_time() {
# System date # System date
prompt_date() { prompt_date() {
set_default POWERLEVEL9K_DATE_FORMAT "%D{%d.%m.%y}" set_default POWERLEVEL9K_DATE_FORMAT "%D{%d.%m.%y}"
[[ -v _P9K_REFRESH_PROMPT ]] || typeset -gH _P9K_DATE=${(%)POWERLEVEL9K_DATE_FORMAT} [[ -v _P9K_REFRESH_PROMPT ]] || typeset -gH _P9K_DATE=$(print -P $POWERLEVEL9K_DATE_FORMAT)
"$1_prompt_segment" "$0" "$2" "$DEFAULT_COLOR_INVERTED" "$DEFAULT_COLOR" "$_P9K_DATE" "DATE_ICON" "$1_prompt_segment" "$0" "$2" "$DEFAULT_COLOR_INVERTED" "$DEFAULT_COLOR" "$_P9K_DATE" "DATE_ICON"
} }