From 2ea3356d6695f1ed6d78c7c76f50415b0091e303 Mon Sep 17 00:00:00 2001 From: Roman Perepelitsa Date: Tue, 27 Oct 2020 12:49:39 +0100 Subject: [PATCH] add __p9k_initial_screen_empty for z4h integration --- internal/p10k.zsh | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/internal/p10k.zsh b/internal/p10k.zsh index 8d7c26d5..66429ea1 100644 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -5755,7 +5755,7 @@ _p9k_set_instant_prompt() { [[ -n $RPROMPT ]] || unset RPROMPT } -typeset -gri __p9k_instant_prompt_version=31 +typeset -gri __p9k_instant_prompt_version=32 _p9k_dump_instant_prompt() { local user=${(%):-%n} @@ -5800,6 +5800,7 @@ _p9k_dump_instant_prompt() { local -i height=$_POWERLEVEL9K_INSTANT_PROMPT_COMMAND_LINES local prompt_dir=${(q)prompt_dir}" >&$fd print -r -- ' + (( __p9k_initial_screen_empty )) && height=0 local real_gitstatus_header if [[ -r $gitstatus_dir/install.info ]]; then IFS= read -r real_gitstatus_header <$gitstatus_dir/install.info || real_gitstatus_header=borked @@ -6052,7 +6053,11 @@ _p9k_dump_instant_prompt() { exec 0<&$__p9k_fd_0 1>&$__p9k_fd_1 2>&$__p9k_fd_2 {__p9k_fd_0}>&- {__p9k_fd_1}>&- {__p9k_fd_2}>&- unset __p9k_fd_0 __p9k_fd_1 __p9k_fd_2 typeset -gi __p9k_instant_prompt_erased=1 - print -rn -- $terminfo[rc]${(%):-%b%k%f%s%u}$terminfo[ed] + if (( __p9k_initial_screen_empty )); then + print -rn -- $'\''\033[2J'\''$terminfo[rc]${(%):-%b%k%f%s%u} + else + print -rn -- $terminfo[rc]${(%):-%b%k%f%s%u}$terminfo[ed] + fi if [[ -s $__p9k_instant_prompt_output ]]; then command cat $__p9k_instant_prompt_output 2>/dev/null if (( $1 )); then @@ -6246,7 +6251,11 @@ function _p9k_clear_instant_prompt() { local -i fill=$((COLUMNS > _p9k__ret ? COLUMNS - _p9k__ret : 0)) local cr=$'\r' local sp="${(%):-%b%k%f%s%u$mark${(pl.$fill.. .)}$cr%b%k%f%s%u%E}" - print -rn -- $terminfo[rc]${(%):-%b%k%f%s%u}$terminfo[ed] + if (( __p9k_initial_screen_empty )); then + print -rn -- $'\e[2J'$terminfo[rc]${(%):-%b%k%f%s%u} + else + print -rn -- $terminfo[rc]${(%):-%b%k%f%s%u}$terminfo[ed] + fi local unexpected=${${${(S)content//$'\e[?'<->'c'}//$'\e['<->' q'}//$'\e'[^$'\a\e']#($'\a'|$'\e\\')} if [[ -n $unexpected ]]; then local omz1='[Oh My Zsh] Would you like to update? [Y/n]: ' @@ -6306,7 +6315,11 @@ function _p9k_clear_instant_prompt() { } 2>/dev/null else zf_rm -f -- $__p9k_instant_prompt_output 2>/dev/null - print -rn -- $terminfo[rc]${(%):-%b%k%f%s%u}$terminfo[ed] + if (( __p9k_initial_screen_empty )); then + print -rn -- $'\e[2J'$terminfo[rc]${(%):-%b%k%f%s%u} + else + print -rn -- $terminfo[rc]${(%):-%b%k%f%s%u}$terminfo[ed] + fi fi prompt_opts=(percent subst sp cr) if [[ $_POWERLEVEL9K_DISABLE_INSTANT_PROMPT == 0 && $__p9k_instant_prompt_active == 2 ]]; then