mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-12-25 00:21:58 +00:00
save/restore screen through z4h to make it work over ssh
This commit is contained in:
parent
85f9e75918
commit
76e5a69262
1 changed files with 20 additions and 11 deletions
|
@ -5755,7 +5755,7 @@ _p9k_set_instant_prompt() {
|
|||
[[ -n $RPROMPT ]] || unset RPROMPT
|
||||
}
|
||||
|
||||
typeset -gri __p9k_instant_prompt_version=33
|
||||
typeset -gri __p9k_instant_prompt_version=35
|
||||
|
||||
_p9k_dump_instant_prompt() {
|
||||
local user=${(%):-%n}
|
||||
|
@ -5800,7 +5800,7 @@ _p9k_dump_instant_prompt() {
|
|||
local -i height=$_POWERLEVEL9K_INSTANT_PROMPT_COMMAND_LINES
|
||||
local prompt_dir=${(q)prompt_dir}"
|
||||
>&$fd print -r -- '
|
||||
[[ -n $_Z4H_TMUX_CMD ]] && height=0
|
||||
(( _z4h_can_save_restore_screen == 1 )) && 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
|
||||
|
@ -6042,12 +6042,9 @@ _p9k_dump_instant_prompt() {
|
|||
exec {__p9k_fd_0}<&0 {__p9k_fd_1}>&1 {__p9k_fd_2}>&2 0<&$fd_null 1>$__p9k_instant_prompt_output
|
||||
exec 2>&1 {fd_null}>&-
|
||||
typeset -gi __p9k_instant_prompt_active=1
|
||||
typeset -g __p9k_instant_prompt_clear=$terminfo[rc]${(%):-%b%k%f%s%u}$terminfo[ed]
|
||||
if [[ -n $_Z4H_TMUX ]]; then
|
||||
local pane
|
||||
if pane="$(TMUX=$_Z4H_TMUX TMUX_PANE= $_Z4H_TMUX_CMD capture-pane -p -e 2>/dev/null && print -n x)"; then
|
||||
__p9k_instant_prompt_clear=${esc}0m${esc}H${${pane//$lf/${esc}K$lf}%${lf}x}$__p9k_instant_prompt_clear
|
||||
fi
|
||||
if (( _z4h_can_save_restore_screen == 1 )); then
|
||||
typeset -g _z4h_saved_screen
|
||||
-z4h-save-screen
|
||||
fi
|
||||
typeset -g __p9k_instant_prompt_dump_file=${XDG_CACHE_HOME:-~/.cache}/p10k-dump-${(%):-%n}.zsh
|
||||
if builtin source $__p9k_instant_prompt_dump_file 2>/dev/null && (( $+functions[_p9k_preinit] )); then
|
||||
|
@ -6060,7 +6057,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 -- $__p9k_instant_prompt_clear
|
||||
if (( _z4h_can_save_restore_screen == 1 && __p9k_instant_prompt_sourced >= 35 )); then
|
||||
-z4h-restore-screen
|
||||
unset _z4h_saved_screen
|
||||
fi
|
||||
print -rn -- $terminfo[rc]${(%):-%b%k%f%s%u}$terminfo[ed]
|
||||
if [[ -s $__p9k_instant_prompt_output ]]; then
|
||||
command cat $__p9k_instant_prompt_output 2>/dev/null
|
||||
if (( $1 )); then
|
||||
|
@ -6254,7 +6255,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 -- ${__p9k_instant_prompt_clear-$terminfo[rc]${(%):-%b%k%f%s%u}$terminfo[ed]}
|
||||
if (( _z4h_can_save_restore_screen == 1 && __p9k_instant_prompt_sourced >= 35 )); then
|
||||
-z4h-restore-screen
|
||||
unset _z4h_saved_screen
|
||||
fi
|
||||
print -rn -- $terminfo[rc]${(%):-%b%k%f%s%u}$terminfo[ed]
|
||||
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]: '
|
||||
|
@ -6314,7 +6319,11 @@ function _p9k_clear_instant_prompt() {
|
|||
} 2>/dev/null
|
||||
else
|
||||
zf_rm -f -- $__p9k_instant_prompt_output 2>/dev/null
|
||||
print -rn -- ${__p9k_instant_prompt_clear-$terminfo[rc]${(%):-%b%k%f%s%u}$terminfo[ed]}
|
||||
if (( _z4h_can_save_restore_screen == 1 && __p9k_instant_prompt_sourced >= 35 )); then
|
||||
-z4h-restore-screen
|
||||
unset _z4h_saved_screen
|
||||
fi
|
||||
print -rn -- $terminfo[rc]${(%):-%b%k%f%s%u}$terminfo[ed]
|
||||
fi
|
||||
prompt_opts=(percent subst sp cr)
|
||||
if [[ $_POWERLEVEL9K_DISABLE_INSTANT_PROMPT == 0 && $__p9k_instant_prompt_active == 2 ]]; then
|
||||
|
|
Loading…
Reference in a new issue