1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-23 16:40:24 +02:00

37192: silence WARN_CREATE_GLOBAL in prompt themes

This commit is contained in:
Barton E. Schaefer 2015-11-22 10:19:49 -08:00
parent acbd2ca701
commit 14487ff5cc
8 changed files with 22 additions and 7 deletions

View file

@ -1,3 +1,13 @@
2015-11-22 Barton E. Schaefer <schaefer@zsh.org>
* 37192: Functions/Prompts/prompt_adam1_setup,
Functions/Prompts/prompt_adam2_setup,
Functions/Prompts/prompt_bart_setup,
Functions/Prompts/prompt_clint_setup,
Functions/Prompts/prompt_oliver_setup,
Functions/Prompts/prompt_special_chars,
Functions/Prompts/promptinit: silence WARN_CREATE_GLOBAL
2015-11-22 Peter Stephenson <p.w.stephenson@ntlworld.com> 2015-11-22 Peter Stephenson <p.w.stephenson@ntlworld.com>
* 37191: Src/utils.c: some locales prduce valid empty output for * 37191: Src/utils.c: some locales prduce valid empty output for

View file

@ -18,6 +18,7 @@ EOF
} }
prompt_adam1_setup () { prompt_adam1_setup () {
setopt localoptions nowarncreateglobal
prompt_adam1_color1=${1:-'blue'} prompt_adam1_color1=${1:-'blue'}
prompt_adam1_color2=${2:-'cyan'} prompt_adam1_color2=${2:-'cyan'}
prompt_adam1_color3=${3:-'green'} prompt_adam1_color3=${3:-'green'}
@ -33,7 +34,7 @@ prompt_adam1_setup () {
} }
prompt_adam1_precmd () { prompt_adam1_precmd () {
setopt noxtrace localoptions setopt localoptions noxtrace nowarncreateglobal
local base_prompt_expanded_no_color base_prompt_etc local base_prompt_expanded_no_color base_prompt_etc
local prompt_length space_left local prompt_length space_left

View file

@ -20,6 +20,7 @@ EOF
prompt_adam2_setup () { prompt_adam2_setup () {
# Some can't be local # Some can't be local
setopt localoptions nowarncreateglobal
local prompt_gfx_tlc prompt_gfx_mlc prompt_gfx_blc local prompt_gfx_tlc prompt_gfx_mlc prompt_gfx_blc
if [[ $1 == '8bit' ]]; then if [[ $1 == '8bit' ]]; then
@ -73,7 +74,7 @@ prompt_adam2_setup () {
} }
prompt_adam2_precmd() { prompt_adam2_precmd() {
setopt noxtrace localoptions extendedglob setopt localoptions extendedglob noxtrace nowarncreateglobal
local prompt_line_1 local prompt_line_1
prompt_adam2_choose_prompt prompt_adam2_choose_prompt

View file

@ -70,8 +70,8 @@ prompt_bart_help () {
print -nP '\n%E' print -nP '\n%E'
} }
integer PSCOL=1 integer -g PSCOL=1
typeset PSCMD= typeset -g PSCMD=
prompt_bart_preexec () { prompt_bart_preexec () {
setopt localoptions noxtrace noshwordsplit noksharrays unset setopt localoptions noxtrace noshwordsplit noksharrays unset
@ -106,7 +106,6 @@ prompt_bart_precmd () {
psvar[8]='' # No padding until we compute it psvar[8]='' # No padding until we compute it
psvar[9]=() psvar[9]=()
typeset -g PSCOL
# Reset the truncation widths for upcoming computations # Reset the truncation widths for upcoming computations
((PSCOL == 1)) || { PSCOL=1 ; prompt_bart_ps1 } ((PSCOL == 1)) || { PSCOL=1 ; prompt_bart_ps1 }
if [[ -o promptcr ]] if [[ -o promptcr ]]

View file

@ -38,12 +38,13 @@ prompt_clint_setup () {
[[ -n "$WINDOW" ]] && p_win="$pc['\(']%F{$pcc[4]}$WINDOW$pc['\)']" [[ -n "$WINDOW" ]] && p_win="$pc['\(']%F{$pcc[4]}$WINDOW$pc['\)']"
p_userpwd="$pc['<']%F{$pcc[3]}%n@%m$p_win%F{$pcc[5]}:%F{$pcc[4]}%~$pc['>']" p_userpwd="$pc['<']%F{$pcc[3]}%n@%m$p_win%F{$pcc[5]}:%F{$pcc[4]}%~$pc['>']"
p_vcs="%(2v.%U%2v%u.)" local p_vcs="%(2v.%U%2v%u.)"
p_shlvlhist="%fzsh%(2L./$SHLVL.) %B%h%b " p_shlvlhist="%fzsh%(2L./$SHLVL.) %B%h%b "
p_rc="%(?..[%?%1v] )" p_rc="%(?..[%?%1v] )"
p_end="%f%B%#%b " p_end="%f%B%#%b "
typeset -ga zle_highlight
zle_highlight[(r)default:*]=default:$pcc[2] zle_highlight[(r)default:*]=default:$pcc[2]
prompt="$p_date$p_tty$p_plat$p_ver prompt="$p_date$p_tty$p_plat$p_ver

View file

@ -37,6 +37,8 @@ prompt_oliver_setup() {
PS1="$pcolr$user$host%~%"'$((COLUMNS-12))'"(l.$prompt_newline. )[%h%1(j.%%%j.)%0(?..:%?)]%# %b%f%k" RPS2='<%^' PS1="$pcolr$user$host%~%"'$((COLUMNS-12))'"(l.$prompt_newline. )[%h%1(j.%%%j.)%0(?..:%?)]%# %b%f%k" RPS2='<%^'
PS2='' PS2=''
typeset -ga zle_highlight
zle_highlight[(r)default:*]=default:$tcolr zle_highlight[(r)default:*]=default:$tcolr
} }

View file

@ -19,6 +19,7 @@ if [[ ${LC_ALL:-${LC_CTYPE:-$LANG}} = *(UTF-8|utf8)* ]]; then
schars[261]=$'\xe2\x96\x92' schars[261]=$'\xe2\x96\x92'
schars[260]=$'\xe2\x96\x91' schars[260]=$'\xe2\x96\x91'
else else
local code
for code in 300 304 332 333 371 372 262 261 260; do for code in 300 304 332 333 371 372 262 261 260; do
eval "schars[$code]=\$'\\$code'" eval "schars[$code]=\$'\\$code'"
done done

View file

@ -160,7 +160,7 @@ Use prompt -h <theme> for help on specific themes.'
for hook in chpwd precmd preexec periodic zshaddhistory zshexit; do for hook in chpwd precmd preexec periodic zshaddhistory zshexit; do
add-zsh-hook -D "${hook}" "prompt_*_${hook}" add-zsh-hook -D "${hook}" "prompt_*_${hook}"
done done
set -A zle_highlight ${zle_highlight:#default:*} typeset -ga zle_highlight=( ${zle_highlight:#default:*} )
(( ${#zle_highlight} )) || unset zle_highlight (( ${#zle_highlight} )) || unset zle_highlight
prompt_$1_setup "$@[2,-1]" && prompt_theme=( "$@" ) prompt_$1_setup "$@[2,-1]" && prompt_theme=( "$@" )