From 3e6a09c777bc868e1be79a1647ec006ccf3b5038 Mon Sep 17 00:00:00 2001 From: nojhan Date: Mon, 30 Aug 2021 15:34:56 +0200 Subject: [PATCH] [dotmatrix] more on vcs --- themes/dotmatrix/dotmatrix.theme | 54 ++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/themes/dotmatrix/dotmatrix.theme b/themes/dotmatrix/dotmatrix.theme index 0c819fb..4e332f5 100644 --- a/themes/dotmatrix/dotmatrix.theme +++ b/themes/dotmatrix/dotmatrix.theme @@ -599,6 +599,30 @@ __dotmatrix_prompt_vcs() { _lp_smart_mark + local diffs= + if (( LP_ENABLE_VCS_DIFFSTATS )) ; then + if [[ "$lp_vcs_commit_ahead" -ne "0" && "$lp_vcs_commit_behind" -ne "0" ]]; then + __dotmatrix_make_field "+$lp_vcs_commit_ahead" "${DOTMATRIX_COLOR_NOTE[@]}" + has_commit+="${dotmatrix_field}" + __dotmatrix_make_sep_soft "${DOTMATRIX_COLOR_NOTE[@]}" + has_commit+="${dotmatrix_sep}" + __dotmatrix_make_field "-$lp_vcs_commit_behind" "${DOTMATRIX_COLOR_NOTE[@]}" + has_commit+="${dotmatrix_field}" + + elif [[ "$lp_vcs_commit_ahead" -ne "0" ]]; then + __dotmatrix_make_field "+$lp_vcs_commit_ahead" "${DOTMATRIX_COLOR_NOTE[@]}" + has_commit+="${dotmatrix_field}" + + elif [[ "$lp_vcs_commit_behind" -ne "0" ]]; then + __dotmatrix_make_field "-$lp_vcs_commit_behind" "${DOTMATRIX_COLOR_NOTE[@]}" + has_commit+="${dotmatrix_field}" + fi + diffs+="${has_commit}" + else + __dotmatrix_make_field "${DOTMATRIX_DIFF}" "${DOTMATRIX_COLOR_LITE[@]}" + diffs+="${dotmatrix_field}" + fi # LP_ENABLE_VCS_DIFFSTATS + # Mark & commits off remote local has_commit= if _lp_vcs_commits_off_remote; then @@ -608,31 +632,15 @@ __dotmatrix_prompt_vcs() { __dotmatrix_make_sep_link "${DOTMATRIX_COLOR_NOTE[@]}" _DOTMATRIX_VCS+="${dotmatrix_sep}" - if (( LP_ENABLE_VCS_DIFFSTATS )) ; then - if [[ "$lp_vcs_commit_ahead" -ne "0" && "$lp_vcs_commit_behind" -ne "0" ]]; then - __dotmatrix_make_field "+$lp_vcs_commit_ahead" "${DOTMATRIX_COLOR_NOTE[@]}" - has_commit+="${dotmatrix_field}" - __dotmatrix_make_sep_soft "${DOTMATRIX_COLOR_NOTE[@]}" - has_commit+="${dotmatrix_sep}" - __dotmatrix_make_field "-$lp_vcs_commit_behind" "${DOTMATRIX_COLOR_NOTE[@]}" - has_commit+="${dotmatrix_field}" + _DOTMATRIX_VCS+="${diffs}" - elif [[ "$lp_vcs_commit_ahead" -ne "0" ]]; then - __dotmatrix_make_field "+$lp_vcs_commit_ahead" "${DOTMATRIX_COLOR_NOTE[@]}" - has_commit+="${dotmatrix_field}" - - elif [[ "$lp_vcs_commit_behind" -ne "0" ]]; then - __dotmatrix_make_field "-$lp_vcs_commit_behind" "${DOTMATRIX_COLOR_NOTE[@]}" - has_commit+="${dotmatrix_field}" - fi - _DOTMATRIX_VCS+="${has_commit}" + if [[ "$lp_vcs_commit_ahead" -ne "0" && "$lp_vcs_commit_behind" -ne "0" ]]; then + __dotmatrix_make_sep_plug "${DOTMATRIX_COLOR_NOTE[@]}" + _DOTMATRIX_VCS+="${dotmatrix_sep}" else - __dotmatrix_make_field "${DOTMATRIX_DIFF}" "${DOTMATRIX_COLOR_NOTE[@]}" - _DOTMATRIX_VCS+="${dotmatrix_field}" - fi # LP_ENABLE_VCS_DIFFSTATS - - __dotmatrix_make_sep_plug "${DOTMATRIX_COLOR_LITE[@]}" - _DOTMATRIX_VCS+="${dotmatrix_sep}" + __dotmatrix_make_sep_plug "${DOTMATRIX_COLOR_LITE[@]}" + _DOTMATRIX_VCS+="${dotmatrix_sep}" + fi else # No commit off remote __dotmatrix_make_field "${DOTMATRIX_VCS}${lp_smart_mark}" "${DOTMATRIX_COLOR_DARK[@]}"