mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-11-25 13:30:07 +00:00
fix a bug that can cause instant prompt to be duplicated in z4h
This commit is contained in:
parent
67f494cf54
commit
515422c727
1 changed files with 17 additions and 6 deletions
|
@ -5893,7 +5893,7 @@ _p9k_set_instant_prompt() {
|
||||||
[[ -n $RPROMPT ]] || unset RPROMPT
|
[[ -n $RPROMPT ]] || unset RPROMPT
|
||||||
}
|
}
|
||||||
|
|
||||||
typeset -gri __p9k_instant_prompt_version=39
|
typeset -gri __p9k_instant_prompt_version=40
|
||||||
|
|
||||||
_p9k_dump_instant_prompt() {
|
_p9k_dump_instant_prompt() {
|
||||||
local user=${(%):-%n}
|
local user=${(%):-%n}
|
||||||
|
@ -6162,18 +6162,29 @@ _p9k_dump_instant_prompt() {
|
||||||
local -i fill=$((COLUMNS > _p9k__ret ? COLUMNS - _p9k__ret : 0))
|
local -i fill=$((COLUMNS > _p9k__ret ? COLUMNS - _p9k__ret : 0))
|
||||||
out+="${(%):-%b%k%f%s%u$mark${(pl.$fill.. .)}$cr%b%k%f%s%u%E}"
|
out+="${(%):-%b%k%f%s%u$mark${(pl.$fill.. .)}$cr%b%k%f%s%u%E}"
|
||||||
fi
|
fi
|
||||||
(( _z4h_can_save_restore_screen == 1 )) || out+="${(pl.$height..$lf.)}$esc${height}A$terminfo[sc]"
|
if (( _z4h_can_save_restore_screen != 1 )); then
|
||||||
|
(( height )) && out+="${(pl.$height..$lf.)}$esc${height}A"
|
||||||
|
out+="$terminfo[sc]"
|
||||||
|
fi
|
||||||
out+=${(%):-"$__p9k_used_instant_prompt[1]$__p9k_used_instant_prompt[2]"}
|
out+=${(%):-"$__p9k_used_instant_prompt[1]$__p9k_used_instant_prompt[2]"}
|
||||||
if [[ -n $__p9k_used_instant_prompt[3] ]]; then
|
if [[ -n $__p9k_used_instant_prompt[3] ]]; then
|
||||||
_p9k_prompt_length "$__p9k_used_instant_prompt[2]"
|
_p9k_prompt_length "$__p9k_used_instant_prompt[2]"
|
||||||
local -i left_len=_p9k__ret
|
local -i left_len=_p9k__ret
|
||||||
_p9k_prompt_length "$__p9k_used_instant_prompt[3]"
|
_p9k_prompt_length "$__p9k_used_instant_prompt[3]"
|
||||||
local -i gap=$((COLUMNS - left_len - _p9k__ret - ZLE_RPROMPT_INDENT))
|
if (( _p9k__ret )); then
|
||||||
if (( gap >= 40 )); then
|
local -i gap=$((COLUMNS - left_len - _p9k__ret - ZLE_RPROMPT_INDENT))
|
||||||
out+="${(pl.$gap.. .)}${(%):-${__p9k_used_instant_prompt[3]}%b%k%f%s%u}$cr$esc${left_len}C"
|
if (( gap >= 40 )); then
|
||||||
|
out+="${(pl.$gap.. .)}${(%):-${__p9k_used_instant_prompt[3]}%b%k%f%s%u}$cr$esc${left_len}C"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if (( _z4h_can_save_restore_screen == 1 )); then
|
||||||
|
if (( height )); then
|
||||||
|
out+="$cr$esc${height}A$terminfo[sc]$out"
|
||||||
|
else
|
||||||
|
out+="$cr$terminfo[sc]$out"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
(( _z4h_can_save_restore_screen == 1 )) && out+="$cr$esc${height}A$terminfo[sc]$out"
|
|
||||||
typeset -g __p9k_instant_prompt_output=${TMPDIR:-/tmp}/p10k-instant-prompt-output-${(%):-%n}-$$
|
typeset -g __p9k_instant_prompt_output=${TMPDIR:-/tmp}/p10k-instant-prompt-output-${(%):-%n}-$$
|
||||||
{ echo -n > $__p9k_instant_prompt_output } || return
|
{ echo -n > $__p9k_instant_prompt_output } || return
|
||||||
print -rn -- "$out" || return
|
print -rn -- "$out" || return
|
||||||
|
|
Loading…
Reference in a new issue