aboutsummaryrefslogtreecommitdiff
path: root/internal/p10k.zsh
diff options
context:
space:
mode:
authorromkatv <roman.perepelitsa@gmail.com>2019-07-18 00:24:53 +0300
committerromkatv <roman.perepelitsa@gmail.com>2019-07-18 00:24:53 +0300
commitf37d7e6742ae98dbd34754d34dfb54e7dc1e2b85 (patch)
tree7441b62ae24af6fcf5fa2117d2d6fa33aa93b443 /internal/p10k.zsh
parent0660d8c97d42c951d6b59702915dc668246124bc (diff)
don't update time unnecessarily
Diffstat (limited to 'internal/p10k.zsh')
-rwxr-xr-xinternal/p10k.zsh22
1 files changed, 11 insertions, 11 deletions
diff --git a/internal/p10k.zsh b/internal/p10k.zsh
index 7ce19414..4560c7f5 100755
--- a/internal/p10k.zsh
+++ b/internal/p10k.zsh
@@ -1900,21 +1900,21 @@ set_default POWERLEVEL9K_EXPERIMENTAL_TIME_REALTIME false
# behavior where they contain the end times of their preceding commands.
set_default POWERLEVEL9K_TIME_UPDATE_ON_COMMAND false
prompt_time() {
- if (( ! $+_P9K_TIME_TEXT )); then
- if [[ $POWERLEVEL9K_EXPERIMENTAL_TIME_REALTIME == true ]]; then
+ if [[ $POWERLEVEL9K_EXPERIMENTAL_TIME_REALTIME == true ]]; then
+ "$1_prompt_segment" "$0" "$2" "$DEFAULT_COLOR_INVERTED" "$DEFAULT_COLOR" "TIME_ICON" 0 '' \
+ "$POWERLEVEL9K_TIME_FORMAT"
+ else
+ local t=${${(%)POWERLEVEL9K_TIME_FORMAT}//\%/%%}
+ if [[ $POWERLEVEL9K_TIME_UPDATE_ON_COMMAND == true ]]; then
+ _p9k_escape $t
+ t=$_P9K_RETVAL
_p9k_escape $POWERLEVEL9K_TIME_FORMAT
- _P9K_TIME_TEXT=("" "$_P9K_RETVAL")
+ "$1_prompt_segment" "$0" "$2" "$DEFAULT_COLOR_INVERTED" "$DEFAULT_COLOR" "TIME_ICON" 1 '' \
+ "\${_P9K_LINE_FINISH-$t}\${_P9K_LINE_FINISH+$_P9K_RETVAL}"
else
- _p9k_escape $POWERLEVEL9K_TIME_FORMAT
- if [[ $POWERLEVEL9K_TIME_UPDATE_ON_COMMAND == true ]]; then
- _P9K_TIME_TEXT=("\${_P9K_LINE_FINISH-$_P9K_RETVAL}" "\${_P9K_LINE_FINISH+$_P9K_RETVAL}")
- else
- _P9K_TIME_TEXT=("$_P9K_RETVAL" "")
- fi
+ "$1_prompt_segment" "$0" "$2" "$DEFAULT_COLOR_INVERTED" "$DEFAULT_COLOR" "TIME_ICON" 0 '' $t
fi
fi
- "$1_prompt_segment" "$0" "$2" "$DEFAULT_COLOR_INVERTED" "$DEFAULT_COLOR" "TIME_ICON" 1 '' \
- "${(%)_P9K_TIME_TEXT[1]//\%/%%}${_P9K_TIME_TEXT[2]}"
}
################################################################