fix bugs in right prompt

pull/145/head
romkatv 5 years ago
parent 1cd711820e
commit 9d88fb83e9

@ -434,7 +434,7 @@ right_prompt_segment() {
# 1 # 1
# elif (( joined )); then # elif (( joined )); then
# 2 # 2
# elif [[ $bg_color == (${_P9K_BG}|${_P9K_BG:-0}) ]]; then # elif [[ $_P9K_BG == (${bg_color}|${bg_color:-0}) ]]; then
# 3 # 3
# else # else
# 4 # 4
@ -459,7 +459,7 @@ right_prompt_segment() {
p+="\${_P9K_N::=}" p+="\${_P9K_N::=}"
p+="\${\${\${_P9K_BG:-0}:#NONE}:-\${_P9K_N::=$((t+1))}}" # 1 p+="\${\${\${_P9K_BG:-0}:#NONE}:-\${_P9K_N::=$((t+1))}}" # 1
p+="\${_P9K_N:=\${\${\$(($join)):#0}:+$((t+2))}}" # 2 p+="\${_P9K_N:=\${\${\$(($join)):#0}:+$((t+2))}}" # 2
p+="\${_P9K_N:=\${\${(M)\${:-x$bg_color}:#x(\$_P9K_BG|\${_P9K_BG:-0})}:+$((t+3))}}" # 3 p+="\${_P9K_N:=\${\${(M)\${:-x\$_P9K_BG}:#x(${(b)bg_color}|${(b)bg_color:-0})}:+$((t+3))}}" # 3
p+="\${_P9K_N:=$((t+4))}" # 4 p+="\${_P9K_N:=$((t+4))}" # 4
p+="\${_P9K_I::=$2}\${_P9K_BG::=$bg_color}" p+="\${_P9K_I::=$2}\${_P9K_BG::=$bg_color}"
@ -535,37 +535,6 @@ right_prompt_segment() {
else else
_P9K_PROMPT+="\${\${:-$7}:+\${\${:-\${P9K_CONTENT::=$_P9K_RETVAL}$_P9K_CACHE_VAL[1]}" _P9K_PROMPT+="\${\${:-$7}:+\${\${:-\${P9K_CONTENT::=$_P9K_RETVAL}$_P9K_CACHE_VAL[1]}"
fi fi
if false; then
# Segment separator logic is the same as in left_prompt_segment except that here #4 and #1 are
# identical.
local t=$#_P9K_T
_p9k_get_icon $1 RIGHT_SEGMENT_SEPARATOR
_P9K_T+="%F{$bg_color}$_P9K_RETVAL$bg$POWERLEVEL9K_WHITESPACE_BETWEEN_RIGHT_SEGMENTS$fg" # 1 # TODO: use _p9k_get_icon prompt_eol RIGHT_SEGMENT_SEPARATOR here
_P9K_T+=$fg # 2
if [[ -z $fg_color ]]; then
_p9k_foreground $DEFAULT_COLOR
_P9K_T+=$bg$_P9K_RETVAL$subsep$POWERLEVEL9K_WHITESPACE_BETWEEN_RIGHT_SEGMENTS$fg # 3
else
_P9K_T+=$bg$fg$subsep$POWERLEVEL9K_WHITESPACE_BETWEEN_RIGHT_SEGMENTS # 3
fi
local pre
pre+="\${_P9K_N::=}"
pre+="\${\${\${_P9K_BG:-0}:#NONE}:-\${_P9K_N::=$((t+1))}}" # 1
pre+="\${_P9K_N:=\${\${\$((_P9K_I>=$_P9K_RIGHT_JOIN[$2])):#0}:+$((t+2))}}" # 2
pre+="\${_P9K_N:=\${\${\$((!\${#\${:-0\$_P9K_BG}:#0$bg_color})):#0}:+$((t+3))}}" # 3
pre+="\${_P9K_N:=$((t+1))}}+}" # 4 == 1
(( _P9K_EMULATE_ZERO_RPROMPT_INDENT )) && pre+=' '
if (( _P9K_EMULATE_ZERO_RPROMPT_INDENT )); then
local space=''
else
_p9k_escape_rcurly $POWERLEVEL9K_WHITESPACE_BETWEEN_RIGHT_SEGMENTS
local space=$_P9K_RETVAL
fi
fi
} }
function p9k_prompt_segment() { function p9k_prompt_segment() {

Loading…
Cancel
Save