Merge branch 'master' of github.com:romkatv/powerlevel10k

pull/78/head
romkatv 6 years ago
commit 23e8dccdeb

@ -394,10 +394,8 @@ prompt_background_jobs() {
$1_prompt_segment $0 $2 "$DEFAULT_COLOR" cyan BACKGROUND_JOBS_ICON 1 '${${(%):-%j}:#0}' "$msg" $1_prompt_segment $0 $2 "$DEFAULT_COLOR" cyan BACKGROUND_JOBS_ICON 1 '${${(%):-%j}:#0}' "$msg"
} }
typeset -g _P9K_XY typeset -g _P9K_XY _P9K_ALIGNED_RPROMPT
typeset -gi _P9K_X _P9K_Y _P9K_M typeset -gi _P9K_X _P9K_Y _P9K_M _P9K_RPROMPT_DONE _P9K_IND
typeset -gi _P9K_RPROMPT_DONE
typeset -g _P9K_ALIGNED_RPROMPT
# Returns 1 if the cursor is at the very end of the screen. # Returns 1 if the cursor is at the very end of the screen.
function _p9k_left_prompt_end_line() { function _p9k_left_prompt_end_line() {
@ -2364,6 +2362,22 @@ _p9k_init_timer() {
fi fi
} }
# Does ZSH have a certain off-by-one bug that triggers when PROMPT overflows to a new line?
#
# Bug: https://github.com/zsh-users/zsh/commit/d8d9fee137a5aa2cf9bf8314b06895bfc2a05518.
# ZSH_PATCHLEVEL=zsh-5.4.2-159-gd8d9fee13. Released in 5.5.
#
# Fix: https://github.com/zsh-users/zsh/commit/64d13738357c9b9c212adbe17f271716abbcf6ea.
# ZSH_PATCHLEVEL=zsh-5.7.1-50-g64d137383.
#
# Test: PROMPT="${(pl:$((COLUMNS))::-:)}<%1(l.%2(l.FAIL.PASS).FAIL)> " zsh -dfis <<<exit
# Workaround: PROMPT="${(pl:$((COLUMNS))::-:)}%{%G%}<%1(l.%2(l.FAIL.PASS).FAIL)> " zsh -dfis <<<exit
function _p9k_prompt_overflow_bug() {
[[ $ZSH_PATCHLEVEL =~ '^zsh-5\.4\.2-([0-9]+)-' ]] && return $(( match[1] < 159 ))
[[ $ZSH_PATCHLEVEL =~ '^zsh-5\.7\.1-([0-9]+)-' ]] && return $(( match[1] >= 50 ))
is-at-least 5.5 && ! is-at-least 5.7.2
}
# Some people write POWERLEVEL9K_DIR_PATH_SEPARATOR='\uNNNN' instead of # Some people write POWERLEVEL9K_DIR_PATH_SEPARATOR='\uNNNN' instead of
# POWERLEVEL9K_DIR_PATH_SEPARATOR=$'\uNNNN'. There is no good reason for it and if we were # POWERLEVEL9K_DIR_PATH_SEPARATOR=$'\uNNNN'. There is no good reason for it and if we were
# starting from scratch we wouldn't perform automatic conversion from the former to the latter. # starting from scratch we wouldn't perform automatic conversion from the former to the latter.
@ -2480,7 +2494,7 @@ _p9k_init() {
_P9K_ALIGNED_RPROMPT+='${_P9K_X::=${_P9K_XY%;*}}' _P9K_ALIGNED_RPROMPT+='${_P9K_X::=${_P9K_XY%;*}}'
_P9K_ALIGNED_RPROMPT+='${_P9K_Y::=${_P9K_XY#*;}}' _P9K_ALIGNED_RPROMPT+='${_P9K_Y::=${_P9K_XY#*;}}'
done done
_P9K_ALIGNED_RPROMPT+='${_P9K_X::=$((_P9K_X+2+${${ZLE_RPROMPT_INDENT:-1}/#-*/0}))}' _P9K_ALIGNED_RPROMPT+='${_P9K_X::=$((_P9K_X+2+_P9K_IND))}'
_P9K_ALIGNED_RPROMPT+='${_P9K_Y::=$((_P9K_X+31))}}+}' _P9K_ALIGNED_RPROMPT+='${_P9K_Y::=$((_P9K_X+31))}}+}'
repeat 32; do repeat 32; do
@ -2490,7 +2504,9 @@ _p9k_init() {
_P9K_ALIGNED_RPROMPT+='%-$_P9K_X(l. .)' _P9K_ALIGNED_RPROMPT+='%-$_P9K_X(l. .)'
done done
_P9K_ALIGNED_RPROMPT+=' $_P9K_RPROMPT' _P9K_ALIGNED_RPROMPT+=' $_P9K_RPROMPT'
_P9K_ALIGNED_RPROMPT+=$'\n' _P9K_ALIGNED_RPROMPT+='$_P9K_T[$((3+!_P9K_IND))]'
_P9K_LEFT_PREFIX+='${${_P9K_IND::=${${ZLE_RPROMPT_INDENT:-1}/#-*/0}}+}'
if [[ $POWERLEVEL9K_PROMPT_ADD_NEWLINE == true ]]; then if [[ $POWERLEVEL9K_PROMPT_ADD_NEWLINE == true ]]; then
repeat ${POWERLEVEL9K_PROMPT_ADD_NEWLINE_COUNT:-1} _P9K_LEFT_PREFIX+=$'\n' repeat ${POWERLEVEL9K_PROMPT_ADD_NEWLINE_COUNT:-1} _P9K_LEFT_PREFIX+=$'\n'
@ -2508,10 +2524,9 @@ _p9k_init() {
_p9k_foreground $_P9K_RETVAL _p9k_foreground $_P9K_RETVAL
_P9K_LEFT_PREFIX+=$_P9K_RETVAL _P9K_LEFT_PREFIX+=$_P9K_RETVAL
[[ $ruler_char == '.' ]] && local sep=',' || local sep='.' [[ $ruler_char == '.' ]] && local sep=',' || local sep='.'
local indent='${${ZLE_RPROMPT_INDENT:-1}/#-*/0}' local ruler_len='${$((COLUMNS-_P9K_IND))/#-*/0}'
local ruler_len="\${\$((COLUMNS-$indent))/#-*/0}"
_P9K_LEFT_PREFIX+="%b\${(pl$sep$ruler_len$sep$sep${(q)ruler_char}$sep)}%k%f" _P9K_LEFT_PREFIX+="%b\${(pl$sep$ruler_len$sep$sep${(q)ruler_char}$sep)}%k%f"
_P9K_LEFT_PREFIX+=$'\n' _P9K_LEFT_PREFIX+='$_P9K_T[$((3+!_P9K_IND))]'
else else
print -P "%F{red}WARNING!%f %BPOWERLEVEL9K_RULER_CHAR%b is not one character long. Ruler won't be rendered." print -P "%F{red}WARNING!%f %BPOWERLEVEL9K_RULER_CHAR%b is not one character long. Ruler won't be rendered."
print -P "Either change the value of %BPOWERLEVEL9K_RULER_CHAR%b or set %BPOWERLEVEL9K_SHOW_RULER=false%b to" print -P "Either change the value of %BPOWERLEVEL9K_RULER_CHAR%b or set %BPOWERLEVEL9K_SHOW_RULER=false%b to"
@ -2527,7 +2542,8 @@ _p9k_init() {
_P9K_RIGHT_PREFIX+='${${_P9K_BG::=NONE}+}${${_P9K_I::=0}+}' _P9K_RIGHT_PREFIX+='${${_P9K_BG::=NONE}+}${${_P9K_I::=0}+}'
_p9k_get_icon LEFT_SEGMENT_SEPARATOR _p9k_get_icon LEFT_SEGMENT_SEPARATOR
_P9K_T=("%f$_P9K_RETVAL" "") _P9K_T=("%f$_P9K_RETVAL" "" $'\n')
_p9k_prompt_overflow_bug && _P9K_T+='%{%G%}' || _P9K_T+=''
_P9K_RIGHT_SUFFIX+='%f%b%k' _P9K_RIGHT_SUFFIX+='%f%b%k'
_P9K_RIGHT_PREFIX+='%f%b%k' _P9K_RIGHT_PREFIX+='%f%b%k'

Loading…
Cancel
Save