generate less code for empty rprompt

pull/145/head
romkatv 6 years ago
parent 428665e551
commit 00a070d5db

@ -2496,19 +2496,23 @@ function _p9k_set_prompt() {
local -i left_idx=1 right_idx=1 num_lines=$#_P9K_LINE_SEGMENTS_LEFT i local -i left_idx=1 right_idx=1 num_lines=$#_P9K_LINE_SEGMENTS_LEFT i
for i in {1..$num_lines}; do for i in {1..$num_lines}; do
local right=0
if [[ $POWERLEVEL9K_DISABLE_RPROMPT == false ]]; then if [[ $POWERLEVEL9K_DISABLE_RPROMPT == false ]]; then
_P9K_PROMPT=$_P9K_LINE_PREFIX_RIGHT[i] _P9K_PROMPT=
_P9K_SEGMENT_INDEX=right_idx _P9K_SEGMENT_INDEX=right_idx
_P9K_PROMPT_SIDE=right _P9K_PROMPT_SIDE=right
for _P9K_SEGMENT_NAME in ${(@0)_P9K_LINE_SEGMENTS_RIGHT[i]}; do for _P9K_SEGMENT_NAME in ${(@0)_P9K_LINE_SEGMENTS_RIGHT[i]}; do
_p9k_build_segment _p9k_build_segment
done done
right_idx=_P9K_SEGMENT_INDEX right_idx=_P9K_SEGMENT_INDEX
_P9K_PROMPT+=$_P9K_LINE_SUFFIX_RIGHT[i] if [[ -n $_P9K_PROMPT || -n $POWERLEVEL9K_EMPTY_LINE_RIGHT_PROMPT_FIRST_SEGMENT_START_SYMBOL ]]; then
if (( i == num_lines )); then _P9K_PROMPT=$_P9K_LINE_PREFIX_RIGHT[i]$_P9K_PROMPT$_P9K_LINE_SUFFIX_RIGHT[i]
RPROMPT=$_P9K_PROMPT if (( i == num_lines )); then
else RPROMPT=$_P9K_PROMPT
PROMPT+='${${_P9K_RPROMPT::=${_P9K_RPROMPT_OVERRIDE-'$_P9K_PROMPT'}}+}' else
right=1
PROMPT+='${${_P9K_RPROMPT::=${_P9K_RPROMPT_OVERRIDE-'$_P9K_PROMPT'}}+}'
fi
fi fi
fi fi
_P9K_PROMPT=$_P9K_LINE_PREFIX_LEFT[i] _P9K_PROMPT=$_P9K_LINE_PREFIX_LEFT[i]
@ -2521,7 +2525,7 @@ function _p9k_set_prompt() {
_P9K_PROMPT+=$_P9K_LINE_SUFFIX_LEFT[i] _P9K_PROMPT+=$_P9K_LINE_SUFFIX_LEFT[i]
PROMPT+=$_P9K_PROMPT PROMPT+=$_P9K_PROMPT
if (( i != num_lines )); then if (( i != num_lines )); then
if [[ $POWERLEVEL9K_DISABLE_RPROMPT == false ]]; then if (( right )); then
PROMPT+=$_P9K_ALIGNED_RPROMPT PROMPT+=$_P9K_ALIGNED_RPROMPT
else else
PROMPT+=$'\n' PROMPT+=$'\n'

Loading…
Cancel
Save