fix how jobs are counted

pull/22/head
romkatv 6 years ago
parent 0fc1203628
commit e54b52ad26

@ -405,21 +405,18 @@ prompt_aws_eb_env() {
set_default POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE true set_default POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE true
set_default POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE_ALWAYS false set_default POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE_ALWAYS false
prompt_background_jobs() { prompt_background_jobs() {
local job_lines=("${(@f)$(jobs -lr)}") local n && n="${(fw)#$(jobs -rd)}" && ((n > 1)) || return
[[ ${(c)#job_lines} == 0 ]] && return (( n /= 2 ))
local num_jobs=$#job_lines
local cache_key="$0 $num_jobs"
local cache_key="$0 $n"
if ! _p9k_cache_get $cache_key; then if ! _p9k_cache_get $cache_key; then
if [[ "$POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE" == "true" && if [[ "$POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE" == "true" &&
("$num_jobs" -gt 1 || "$POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE_ALWAYS" == "true") ]]; then ("$n" -gt 1 || "$POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE_ALWAYS" == "true") ]]; then
_p9k_cache_set $cache_key $num_jobs _p9k_cache_set $cache_key $n
else else
_p9k_cache_set $cache_key '' _p9k_cache_set $cache_key ''
fi fi
fi fi
"$1_prompt_segment" "$0" "$2" "$DEFAULT_COLOR" "cyan" "$_P9K_RETVAL" 'BACKGROUND_JOBS_ICON' "$1_prompt_segment" "$0" "$2" "$DEFAULT_COLOR" "cyan" "$_P9K_RETVAL" 'BACKGROUND_JOBS_ICON'
} }

Loading…
Cancel
Save