aboutsummaryrefslogtreecommitdiff
path: root/internal/p10k.zsh
diff options
context:
space:
mode:
authorromkatv <roman.perepelitsa@gmail.com>2020-01-03 11:56:33 +0300
committerromkatv <roman.perepelitsa@gmail.com>2020-01-03 11:56:33 +0300
commit2291458a5a6c9b1140df9152ad624ebc58e5dcad (patch)
tree62f1d21f90b03d9f7f6235cb2e918f184a9f9cb8 /internal/p10k.zsh
parent197e542a84cd00ca862aae3bd6a687fb05bbf70b (diff)
show the number of filtered toto tasks if not the same as total and add options to hide todo when filtered and/or total is zero
Diffstat (limited to 'internal/p10k.zsh')
-rw-r--r--internal/p10k.zsh14
1 files changed, 12 insertions, 2 deletions
diff --git a/internal/p10k.zsh b/internal/p10k.zsh
index 914d55a0..917a0a0f 100644
--- a/internal/p10k.zsh
+++ b/internal/p10k.zsh
@@ -2612,7 +2612,15 @@ prompt_todo() {
(( $_p9k_cache_val[1] )) || return
typeset -gi P9K_TODO_FILTERED_TASK_COUNT=$_p9k_cache_val[2]
typeset -gi P9K_TODO_TOTAL_TASK_COUNT=$_p9k_cache_val[3]
- _p9k_prompt_segment "$0" "grey50" "$_p9k_color1" 'TODO_ICON' 0 '' "$P9K_TODO_TOTAL_TASK_COUNT"
+ if (( (P9K_TODO_TOTAL_TASK_COUNT || !_POWERLEVEL9K_TODO_HIDE_ZERO_TOTAL) &&
+ (P9K_TODO_FILTERED_TASK_COUNT || !_POWERLEVEL9K_TODO_HIDE_ZERO_FILTERED) )); then
+ if (( P9K_TODO_TOTAL_TASK_COUNT == P9K_TODO_FILTERED_TASK_COUNT )); then
+ local text=$P9K_TODO_TOTAL_TASK_COUNT
+ else
+ local text="$P9K_TODO_FILTERED_TASK_COUNT/$P9K_TODO_TOTAL_TASK_COUNT"
+ fi
+ _p9k_prompt_segment "$0" "grey50" "$_p9k_color1" 'TODO_ICON' 0 '' "$text"
+ fi
}
################################################################
@@ -4933,6 +4941,8 @@ _p9k_init_params() {
_p9k_declare -s POWERLEVEL9K_TRANSIENT_PROMPT off
[[ $_POWERLEVEL9K_TRANSIENT_PROMPT == (off|always|same-dir) ]] || _POWERLEVEL9K_TRANSIENT_PROMPT=off
+ _p9k_declare -b POWERLEVEL9K_TODO_HIDE_ZERO_TOTAL 0
+ _p9k_declare -b POWERLEVEL9K_TODO_HIDE_ZERO_FILTERED 0
_p9k_declare -b POWERLEVEL9K_DISABLE_HOT_RELOAD 0
_p9k_declare -F POWERLEVEL9K_NEW_TTY_MAX_AGE_SECONDS 5
_p9k_declare -i POWERLEVEL9K_INSTANT_PROMPT_COMMAND_LINES 1
@@ -5676,7 +5686,7 @@ _p9k_must_init() {
[[ $sig == $_p9k__param_sig ]] && return 1
_p9k_deinit
fi
- _p9k__param_pat=$'v21\1'${ZSH_VERSION}$'\1'${ZSH_PATCHLEVEL}$'\1'
+ _p9k__param_pat=$'v22\1'${ZSH_VERSION}$'\1'${ZSH_PATCHLEVEL}$'\1'
_p9k__param_pat+=$'${#parameters[(I)POWERLEVEL9K_*]}\1${(%):-%n%#}\1$GITSTATUS_LOG_LEVEL\1'
_p9k__param_pat+=$'$GITSTATUS_ENABLE_LOGGING\1$GITSTATUS_DAEMON\1$GITSTATUS_NUM_THREADS\1'
_p9k__param_pat+=$'$DEFAULT_USER\1${ZLE_RPROMPT_INDENT:-1}\1$P9K_SSH\1$__p9k_ksh_arrays'