aboutsummaryrefslogtreecommitdiff
path: root/internal/p10k.zsh
diff options
context:
space:
mode:
authorromkatv <roman.perepelitsa@gmail.com>2019-07-11 20:04:42 +0300
committerromkatv <roman.perepelitsa@gmail.com>2019-07-11 20:04:42 +0300
commit9d88fb83e9cd0e3140fb48b902737b1c83e87837 (patch)
treee678fba82dd6e5a0280ebd24a6421e2a34601e11 /internal/p10k.zsh
parent1cd711820e5ee479d104a2e513c5f38cde76aae1 (diff)
fix bugs in right prompt
Diffstat (limited to 'internal/p10k.zsh')
-rwxr-xr-xinternal/p10k.zsh47
1 files changed, 8 insertions, 39 deletions
diff --git a/internal/p10k.zsh b/internal/p10k.zsh
index 22044c80..a10e8a86 100755
--- a/internal/p10k.zsh
+++ b/internal/p10k.zsh
@@ -434,22 +434,22 @@ 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
# fi
local t=$#_P9K_T
- _P9K_T+=$start_sep$style$left_space # 1
- _P9K_T+=$w$style # 2
+ _P9K_T+=$start_sep$style$left_space # 1
+ _P9K_T+=$w$style # 2
if [[ -z $fg_color ]]; then
_p9k_foreground $DEFAULT_COLOR
_P9K_T+=$w%b$bg$_P9K_RETVAL$subsep$style$left_space # 3
else
_P9K_T+=$w%b$bg$fg$subsep$style$left_space # 3
fi
- _P9K_T+=$w%F{$bg_color}$sep$style$left_space # 4
+ _P9K_T+=$w%F{$bg_color}$sep$style$left_space # 4
local join="_P9K_I>=$_P9K_RIGHT_JOIN[$2]"
_p9k_param $1 SELF_JOINED false
@@ -457,10 +457,10 @@ right_prompt_segment() {
local p=
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:=$((t+4))}" # 4
+ p+="\${\${\${_P9K_BG:-0}:#NONE}:-\${_P9K_N::=$((t+1))}}" # 1
+ p+="\${_P9K_N:=\${\${\$(($join)):#0}:+$((t+2))}}" # 2
+ 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() {