1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-11-21 11:50:07 +00:00

add p10k-deactivate-instant-prompt

Function p10k-deactivate-instant-prompt is defined when and only when
instant prompt is active. Invoking it erases and deactivates instant
prompt.
This commit is contained in:
Roman Perepelitsa 2024-03-18 15:40:38 +01:00
parent 07a971d310
commit 93d074a82b

View file

@ -6467,6 +6467,12 @@ _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 {__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}>&- exec 2>&1 {fd_null}>&-
typeset -gi __p9k_instant_prompt_active=1 typeset -gi __p9k_instant_prompt_active=1
function p10k-deactivate-instant-prompt() {
'$__p9k_intro_no_locale'
_p9k_clear_instant_prompt
builtin unset __p9k_instant_prompt_active
builtin unfunction p10k-deactivate-instant-prompt
}
if (( _z4h_can_save_restore_screen == 1 )); then if (( _z4h_can_save_restore_screen == 1 )); then
typeset -g _z4h_saved_screen typeset -g _z4h_saved_screen
-z4h-save-screen -z4h-save-screen
@ -6479,6 +6485,7 @@ _p9k_dump_instant_prompt() {
(( ZSH_SUBSHELL == 0 && ${+__p9k_instant_prompt_active} )) || return 0 (( ZSH_SUBSHELL == 0 && ${+__p9k_instant_prompt_active} )) || return 0
'$__p9k_intro_no_locale' '$__p9k_intro_no_locale'
unset __p9k_instant_prompt_active unset __p9k_instant_prompt_active
(( $+functions[p10k-deactivate-instant-prompt] )) && unfunction p10k-deactivate-instant-prompt
exec 0<&$__p9k_fd_0 1>&$__p9k_fd_1 2>&$__p9k_fd_2 {__p9k_fd_0}>&- {__p9k_fd_1}>&- {__p9k_fd_2}>&- 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 unset __p9k_fd_0 __p9k_fd_1 __p9k_fd_2
typeset -gi __p9k_instant_prompt_erased=1 typeset -gi __p9k_instant_prompt_erased=1
@ -6906,10 +6913,7 @@ function _p9k_on_expand() {
(( _p9k__fully_initialized )) || _p9k_wrap_widgets (( _p9k__fully_initialized )) || _p9k_wrap_widgets
fi fi
if (( $+__p9k_instant_prompt_active )); then (( $+functions[p10k-deactivate-instant-prompt] )) && p10k-deactivate-instant-prompt
_p9k_clear_instant_prompt
unset __p9k_instant_prompt_active
fi
if (( ! _p9k__expanded )); then if (( ! _p9k__expanded )); then
_p9k__expanded=1 _p9k__expanded=1
@ -6981,8 +6985,7 @@ _p9k_precmd_impl() {
_p9k_can_configure -q _p9k_can_configure -q
local -i ret=$? local -i ret=$?
if (( ret == 2 && $+__p9k_instant_prompt_active )); then if (( ret == 2 && $+__p9k_instant_prompt_active )); then
_p9k_clear_instant_prompt p10k-deactivate-instant-prompt
unset __p9k_instant_prompt_active
_p9k_delete_instant_prompt _p9k_delete_instant_prompt
zf_rm -f -- $__p9k_dump_file{,.zwc} 2>/dev/null zf_rm -f -- $__p9k_dump_file{,.zwc} 2>/dev/null
() { () {
@ -9437,10 +9440,7 @@ function p10k() {
return 1 return 1
;; ;;
clear-instant-prompt) clear-instant-prompt)
if (( $+__p9k_instant_prompt_active )); then (( $+functions[p10k-deactivate-instant-prompt] )) && p10k-deactivate-instant-prompt
_p9k_clear_instant_prompt
unset __p9k_instant_prompt_active
fi
return 0 return 0
;; ;;
*) *)
@ -9477,7 +9477,7 @@ if [[ $__p9k_dump_file != $__p9k_instant_prompt_dump_file && -n $__p9k_instant_p
zf_rm -f -- $__p9k_instant_prompt_dump_file{,.zwc} 2>/dev/null zf_rm -f -- $__p9k_instant_prompt_dump_file{,.zwc} 2>/dev/null
fi fi
typeset -g P9K_VERSION=1.20.5 typeset -g P9K_VERSION=1.20.6
unset VSCODE_SHELL_INTEGRATION unset VSCODE_SHELL_INTEGRATION
_p9k_init_ssh _p9k_init_ssh