theme/powerline-multiline: `shfmt`

pull/2051/head
John D Pell 2022-01-17 13:24:39 -08:00
parent b16d7efcf5
commit 6b02cd34b5
1 changed files with 83 additions and 79 deletions

View File

@ -1,12 +1,16 @@
. "$BASH_IT/themes/powerline/powerline.base.bash"
# shellcheck shell=bash
# shellcheck disable=SC2034 # Expected behavior for themes.
# shellcheck source-path=SCRIPTDIR/../powerline
source "${BASH_IT?}/themes/powerline/powerline.base.bash"
function __powerline_last_status_prompt {
[[ "$1" -ne 0 ]] && echo "$(set_color ${LAST_STATUS_THEME_PROMPT_COLOR} -) ${1} ${normal}"
}
function __powerline_right_segment {
local OLD_IFS="${IFS}"; IFS="|"
local params=( $1 )
local OLD_IFS="${IFS}"
IFS="|"
local params=($1)
IFS="${OLD_IFS}"
local padding=0
local pad_before_segment=" "
@ -16,7 +20,7 @@ function __powerline_right_segment {
pad_before_segment=""
fi
RIGHT_PROMPT+="$(set_color ${params[1]} -)${POWERLINE_RIGHT_END}${normal}"
(( padding += 1 ))
((padding += 1))
else
if [[ "${POWERLINE_COMPACT_BEFORE_SEPARATOR}" -ne 0 ]]; then
pad_before_segment=""
@ -25,29 +29,29 @@ function __powerline_right_segment {
#
if [[ "${POWERLINE_COMPACT_AFTER_SEPARATOR}" -eq 0 ]]; then
RIGHT_PROMPT+="$(set_color - ${LAST_SEGMENT_COLOR}) ${normal}"
(( padding += 1 ))
((padding += 1))
fi
if [[ "${LAST_SEGMENT_COLOR}" -eq "${params[1]}" ]]; then
RIGHT_PROMPT+="$(set_color - ${LAST_SEGMENT_COLOR})${POWERLINE_RIGHT_SEPARATOR_SOFT}${normal}"
else
RIGHT_PROMPT+="$(set_color ${params[1]} ${LAST_SEGMENT_COLOR})${POWERLINE_RIGHT_SEPARATOR}${normal}"
fi
(( padding += 1 ))
((padding += 1))
fi
RIGHT_PROMPT+="$(set_color - ${params[1]})${pad_before_segment}${params[0]}${normal}"
(( padding += ${#pad_before_segment} ))
(( padding += ${#params[0]} ))
((padding += ${#pad_before_segment}))
((padding += ${#params[0]}))
(( RIGHT_PROMPT_LENGTH += padding ))
((RIGHT_PROMPT_LENGTH += padding))
LAST_SEGMENT_COLOR="${params[1]}"
(( SEGMENTS_AT_RIGHT += 1 ))
((SEGMENTS_AT_RIGHT += 1))
}
function __powerline_right_first_segment_padding {
RIGHT_PROMPT+="$(set_color - ${LAST_SEGMENT_COLOR}) ${normal}"
(( RIGHT_PROMPT_LENGTH += 1 ))
((RIGHT_PROMPT_LENGTH += 1))
}
function __powerline_prompt_command {
@ -89,7 +93,7 @@ function __powerline_prompt_command {
RIGHT_PAD=$(printf "%.s " $(seq 1 $RIGHT_PROMPT_LENGTH))
LEFT_PROMPT+="${RIGHT_PAD}${move_cursor_rightmost}"
LEFT_PROMPT+="\033[$(( ${#RIGHT_PAD} - 1 ))D"
LEFT_PROMPT+="\033[$((${#RIGHT_PAD} - 1))D"
fi
local prompt="${PROMPT_CHAR}"