From d71d1409c45586489eec1c7cd0823b8ffed04cc9 Mon Sep 17 00:00:00 2001 From: romkatv Date: Wed, 12 Feb 2020 11:15:12 +0100 Subject: [PATCH] fix `p10k display -a` --- internal/p10k.zsh | 10 ++++++++-- powerlevel10k.zsh-theme | 14 +++++++++++--- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/internal/p10k.zsh b/internal/p10k.zsh index e6360bfd..19059777 100644 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -1,4 +1,4 @@ -if [[ $__p9k_sourced != 5 ]]; then +if [[ $__p9k_sourced != 6 ]]; then >&2 print -P "" >&2 print -P "[%F{1}ERROR%f]: Corrupted powerlevel10k installation." >&2 print -P "" @@ -7562,7 +7562,7 @@ typeset -gi __p9k_reset_state function p10k() { [[ $# != 1 || $1 != finalize ]] || { p10k-instant-prompt-finalize; return 0 } - eval "$__p9k_intro" + eval "$__p9k_intro_no_reply" if (( !ARGC )); then print -rP -- $__p9k_p10k_usage >&2 @@ -7571,6 +7571,8 @@ function p10k() { case $1 in segment) + local REPLY + local -a reply shift local -i OPTIND local OPTARG opt state bg=0 fg icon cond text ref=0 expand=0 @@ -7635,6 +7637,8 @@ function p10k() { done return 0 fi + local REPLY + local -a reply for opt in "${@:$OPTIND}"; do pair=(${(s:=:)opt}) list=(${(s:,:)${pair[2]}}) @@ -7677,6 +7681,8 @@ function p10k() { print -rP -- $__p9k_p10k_configure_usage >&2 return 1 fi + local REPLY + local -a reply p9k_configure "$@" || return ;; reload) diff --git a/powerlevel10k.zsh-theme b/powerlevel10k.zsh-theme index 9bb680fe..3e76aac8 100644 --- a/powerlevel10k.zsh-theme +++ b/powerlevel10k.zsh-theme @@ -18,12 +18,20 @@ 'builtin' 'setopt' 'no_aliases' 'no_sh_glob' 'brace_expand' (( $+__p9k_root_dir )) || typeset -gr __p9k_root_dir=${POWERLEVEL9K_INSTALLATION_DIR:-${${(%):-%x}:A:h}} -# Note: leading spaces before `local` are important. Otherwise Antigen will remove `local` (!!!). -(( $+__p9k_intro )) || typeset -gr __p9k_intro='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 +(( $+__p9k_intro )) || { + # Note: leading spaces before `local` are important. Otherwise Antigen will remove `local` (!!!). + typeset -gr __p9k_intro='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 local -a match mbegin mend reply local -i MBEGIN MEND OPTIND local MATCH REPLY OPTARG IFS=$'\'' \t\n\0'\'' [[ -z $_p9k__locale ]] || local LC_ALL=$_p9k__locale' + # The same as above but without `local -a reply` and `local REPLY`. + typeset -gr __p9k_intro_no_reply='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 + local -a match mbegin mend + local -i MBEGIN MEND OPTIND + local REPLY OPTARG IFS=$'\'' \t\n\0'\'' + [[ -z $_p9k__locale ]] || local LC_ALL=$_p9k__locale' +} () { eval "$__p9k_intro" @@ -35,7 +43,7 @@ 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=5 + typeset -gr __p9k_sourced=6 if [[ -w $__p9k_root_dir && -w $__p9k_root_dir/internal && -w $__p9k_root_dir/gitstatus && ${(%):-%#} == % ]]; then local f for f in $__p9k_root_dir/{powerlevel9k.zsh-theme,powerlevel10k.zsh-theme,internal/p10k.zsh,internal/icons.zsh,internal/configure.zsh,internal/worker.zsh,internal/parser.zsh,gitstatus/gitstatus.plugin.zsh}; do