From 2291458a5a6c9b1140df9152ad624ebc58e5dcad Mon Sep 17 00:00:00 2001 From: romkatv Date: Fri, 3 Jan 2020 09:56:33 +0100 Subject: [PATCH] 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 --- internal/p10k.zsh | 14 ++++++++++++-- 1 file 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'