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

block SIGINT in nested p10k calls; allow SIGINT in gitstatus_start

This commit is contained in:
romkatv 2020-05-19 10:10:43 +02:00
parent c0ff47bea5
commit e3beeea0ae
2 changed files with 28 additions and 13 deletions

View file

@ -1,4 +1,4 @@
if [[ $__p9k_sourced != 11 ]]; then if [[ $__p9k_sourced != 12 ]]; then
>&2 print -P "" >&2 print -P ""
>&2 print -P "[%F{1}ERROR%f]: Corrupted powerlevel10k installation." >&2 print -P "[%F{1}ERROR%f]: Corrupted powerlevel10k installation."
>&2 print -P "" >&2 print -P ""
@ -7882,7 +7882,16 @@ _p9k_init_vcs() {
_p9k_segment_in_use vcs || return _p9k_segment_in_use vcs || return
_p9k_vcs_info_init _p9k_vcs_info_init
if (( $+functions[_p9k_preinit] )); then if (( $+functions[_p9k_preinit] )); then
(( $+GITSTATUS_DAEMON_PID_POWERLEVEL9K )) && gitstatus_start_p9k_ POWERLEVEL9K if (( $+GITSTATUS_DAEMON_PID_POWERLEVEL9K )); then
() {
trap 'return 130' INT
{
gitstatus_start_p9k_ POWERLEVEL9K
} always {
trap ':' INT
}
}
fi
return 0 return 0
fi fi
(( _POWERLEVEL9K_DISABLE_GITSTATUS )) && return (( _POWERLEVEL9K_DISABLE_GITSTATUS )) && return
@ -7910,14 +7919,21 @@ _p9k_init_vcs() {
-a POWERLEVEL9K -a POWERLEVEL9K
}" }"
source $gitstatus_dir/gitstatus.plugin.zsh _p9k_ || return source $gitstatus_dir/gitstatus.plugin.zsh _p9k_ || return
gitstatus_start_p9k_ \ () {
-s $_POWERLEVEL9K_VCS_STAGED_MAX_NUM \ trap 'return 130' INT
-u $_POWERLEVEL9K_VCS_UNSTAGED_MAX_NUM \ {
-d $_POWERLEVEL9K_VCS_UNTRACKED_MAX_NUM \ gitstatus_start_p9k_ \
-c $_POWERLEVEL9K_VCS_CONFLICTED_MAX_NUM \ -s $_POWERLEVEL9K_VCS_STAGED_MAX_NUM \
-m $_POWERLEVEL9K_VCS_MAX_INDEX_SIZE_DIRTY \ -u $_POWERLEVEL9K_VCS_UNSTAGED_MAX_NUM \
${${_POWERLEVEL9K_VCS_RECURSE_UNTRACKED_DIRS:#0}:+-e} \ -d $_POWERLEVEL9K_VCS_UNTRACKED_MAX_NUM \
POWERLEVEL9K -c $_POWERLEVEL9K_VCS_CONFLICTED_MAX_NUM \
-m $_POWERLEVEL9K_VCS_MAX_INDEX_SIZE_DIRTY \
${${_POWERLEVEL9K_VCS_RECURSE_UNTRACKED_DIRS:#0}:+-e} \
POWERLEVEL9K
} always {
trap ':' INT
}
}
} }
_p9k_init() { _p9k_init() {

View file

@ -23,8 +23,7 @@
# __p9k_trapint is to work around bugs in zsh: https://www.zsh.org/mla/workers/2020/msg00612.html. # __p9k_trapint is to work around bugs in zsh: https://www.zsh.org/mla/workers/2020/msg00612.html.
# Likewise for `trap ":"` instead of the plain `trap ""`. # Likewise for `trap ":"` instead of the plain `trap ""`.
typeset -gr __p9k_intro_base='emulate -L zsh -o no_hist_expand -o extended_glob -o no_prompt_bang -o prompt_percent -o no_prompt_subst -o no_aliases -o no_bg_nice -o typeset_silent typeset -gr __p9k_intro_base='emulate -L zsh -o no_hist_expand -o extended_glob -o no_prompt_bang -o prompt_percent -o no_prompt_subst -o no_aliases -o no_bg_nice -o typeset_silent
trap ":" INT (( $+__p9k_trapped )) || { local -i __p9k_trapped; trap : INT; trap "trap ${(q)__p9k_trapint:--} INT" EXIT }
trap "trap ${(q)__p9k_trapint:--} INT" EXIT
local -a match mbegin mend local -a match mbegin mend
local -i MBEGIN MEND OPTIND local -i MBEGIN MEND OPTIND
local MATCH OPTARG IFS=$'\'' \t\n\0'\' local MATCH OPTARG IFS=$'\'' \t\n\0'\'
@ -58,7 +57,7 @@ function _p9k_init_locale() {
if [[ $__p9k_dump_file != $__p9k_instant_prompt_dump_file ]] && (( ! $+functions[_p9k_preinit] )) && source $__p9k_dump_file 2>/dev/null && (( $+functions[_p9k_preinit] )); then if [[ $__p9k_dump_file != $__p9k_instant_prompt_dump_file ]] && (( ! $+functions[_p9k_preinit] )) && source $__p9k_dump_file 2>/dev/null && (( $+functions[_p9k_preinit] )); then
_p9k_preinit _p9k_preinit
fi fi
typeset -gr __p9k_sourced=11 typeset -gr __p9k_sourced=12
if [[ $ZSH_VERSION == (5.<1->*|<6->.*) ]]; then if [[ $ZSH_VERSION == (5.<1->*|<6->.*) ]]; then
if [[ -w $__p9k_root_dir && -w $__p9k_root_dir/internal && -w $__p9k_root_dir/gitstatus ]]; then if [[ -w $__p9k_root_dir && -w $__p9k_root_dir/internal && -w $__p9k_root_dir/gitstatus ]]; then
local f local f