1
0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-12-12 19:18:28 +02:00

fix bugs in right prompt

This commit is contained in:
romkatv 2019-07-11 19:04:42 +02:00
parent 1cd711820e
commit 9d88fb83e9

View File

@ -434,7 +434,7 @@ right_prompt_segment() {
# 1
# elif (( joined )); then
# 2
# elif [[ $bg_color == (${_P9K_BG}|${_P9K_BG:-0}) ]]; then
# elif [[ $_P9K_BG == (${bg_color}|${bg_color:-0}) ]]; then
# 3
# else
# 4
@ -459,7 +459,7 @@ right_prompt_segment() {
p+="\${_P9K_N::=}"
p+="\${\${\${_P9K_BG:-0}:#NONE}:-\${_P9K_N::=$((t+1))}}" # 1
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_I::=$2}\${_P9K_BG::=$bg_color}"
@ -535,37 +535,6 @@ right_prompt_segment() {
else
_P9K_PROMPT+="\${\${:-$7}:+\${\${:-\${P9K_CONTENT::=$_P9K_RETVAL}$_P9K_CACHE_VAL[1]}"
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() {