block SIGINT while powerlevel10k is running

This commit is contained in:
romkatv 2020-05-06 21:05:01 +02:00
parent c7efd5badb
commit 5d41bf4703
2 changed files with 13 additions and 4 deletions

View file

@ -1,4 +1,4 @@
if [[ $__p9k_sourced != 10 ]]; then
if [[ $__p9k_sourced != 11 ]]; then
>&2 print -P ""
>&2 print -P "[%F{1}ERROR%f]: Corrupted powerlevel10k installation."
>&2 print -P ""
@ -5244,7 +5244,8 @@ _p9k_prompt_haskell_stack_init() {
# YSU_HARDCORE=1. See https://github.com/romkatv/powerlevel10k/issues/427.
_p9k_preexec1() {
_p9k_restore_special_params
(( ${+functions[TRAPINT]} )) || trap - INT
unset __p9k_trapint
trap - INT
}
_p9k_preexec2() {
@ -6446,15 +6447,21 @@ _p9k_trapint() {
_p9k_precmd() {
__p9k_new_status=$?
__p9k_new_pipestatus=($pipestatus)
trap "" INT
[[ -o ksh_arrays ]] && __p9k_ksh_arrays=1 || __p9k_ksh_arrays=0
[[ -o sh_glob ]] && __p9k_sh_glob=1 || __p9k_sh_glob=0
_p9k_restore_special_params
_p9k_precmd_impl
(( ${+functions[TRAPINT]} )) || trap '_p9k_trapint; return 130' INT
[[ ${+__p9k_instant_prompt_active} == 0 || -o no_prompt_cr ]] || __p9k_instant_prompt_active=2
setopt no_local_options no_prompt_bang prompt_percent prompt_subst prompt_cr prompt_sp
# See https://www.zsh.org/mla/workers/2020/msg00612.html for the reason behind __p9k_trapint.
typeset -g __p9k_trapint='_p9k_trapint; return 130'
trap $__p9k_trapint INT
}
function _p9k_reset_prompt() {

View file

@ -21,6 +21,8 @@
(( $+__p9k_intro )) || {
# Note: leading spaces before `local` are important. Otherwise Antigen will remove `local` (!!!).
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
trap "trap ${(q)__p9k_trapint:-} INT" EXIT
local -a match mbegin mend
local -i MBEGIN MEND OPTIND
local MATCH OPTARG IFS=$'\'' \t\n\0'\'
@ -54,7 +56,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
_p9k_preinit
fi
typeset -gr __p9k_sourced=10
typeset -gr __p9k_sourced=11
if [[ $ZSH_VERSION == (5.<1->*|<6->.*) ]]; then
if [[ -w $__p9k_root_dir && -w $__p9k_root_dir/internal && -w $__p9k_root_dir/gitstatus ]]; then
local f