Merge pull request #275 from zsh-users/fixes/warn_nested_var_opt

Use typeset -g to avoid warnnestedvar warnings
This commit is contained in:
Eric Freese 2017-09-27 15:02:15 -06:00 committed by GitHub
commit 680ce21f26
5 changed files with 12 additions and 12 deletions

View file

@ -10,14 +10,14 @@ _zsh_autosuggest_incr_bind_count() {
_ZSH_AUTOSUGGEST_BIND_COUNTS[$1]=1 _ZSH_AUTOSUGGEST_BIND_COUNTS[$1]=1
fi fi
bind_count=$_ZSH_AUTOSUGGEST_BIND_COUNTS[$1] typeset -gi bind_count=$_ZSH_AUTOSUGGEST_BIND_COUNTS[$1]
} }
_zsh_autosuggest_get_bind_count() { _zsh_autosuggest_get_bind_count() {
if ((${+_ZSH_AUTOSUGGEST_BIND_COUNTS[$1]})); then if ((${+_ZSH_AUTOSUGGEST_BIND_COUNTS[$1]})); then
bind_count=$_ZSH_AUTOSUGGEST_BIND_COUNTS[$1] typeset -gi bind_count=$_ZSH_AUTOSUGGEST_BIND_COUNTS[$1]
else else
bind_count=0 typeset -gi bind_count=0
fi fi
} }

View file

@ -18,7 +18,7 @@ _zsh_autosuggest_highlight_apply() {
typeset -g _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT typeset -g _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT
if [ $#POSTDISPLAY -gt 0 ]; then if [ $#POSTDISPLAY -gt 0 ]; then
_ZSH_AUTOSUGGEST_LAST_HIGHLIGHT="$#BUFFER $(($#BUFFER + $#POSTDISPLAY)) $ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE" typeset -g _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT="$#BUFFER $(($#BUFFER + $#POSTDISPLAY)) $ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE"
region_highlight+=("$_ZSH_AUTOSUGGEST_LAST_HIGHLIGHT") region_highlight+=("$_ZSH_AUTOSUGGEST_LAST_HIGHLIGHT")
else else
unset _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT unset _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT

View file

@ -11,5 +11,5 @@ _zsh_autosuggest_strategy_default() {
# Get the history items that match # Get the history items that match
# - (r) subscript flag makes the pattern match on values # - (r) subscript flag makes the pattern match on values
suggestion="${history[(r)${(b)prefix}*]}" typeset -g suggestion="${history[(r)${(b)prefix}*]}"
} }

View file

@ -48,5 +48,5 @@ _zsh_autosuggest_strategy_match_prev_cmd() {
done done
# Give back the matched history entry # Give back the matched history entry
suggestion="$history[$histkey]" typeset -g suggestion="$history[$histkey]"
} }

View file

@ -131,14 +131,14 @@ _zsh_autosuggest_incr_bind_count() {
_ZSH_AUTOSUGGEST_BIND_COUNTS[$1]=1 _ZSH_AUTOSUGGEST_BIND_COUNTS[$1]=1
fi fi
bind_count=$_ZSH_AUTOSUGGEST_BIND_COUNTS[$1] typeset -gi bind_count=$_ZSH_AUTOSUGGEST_BIND_COUNTS[$1]
} }
_zsh_autosuggest_get_bind_count() { _zsh_autosuggest_get_bind_count() {
if ((${+_ZSH_AUTOSUGGEST_BIND_COUNTS[$1]})); then if ((${+_ZSH_AUTOSUGGEST_BIND_COUNTS[$1]})); then
bind_count=$_ZSH_AUTOSUGGEST_BIND_COUNTS[$1] typeset -gi bind_count=$_ZSH_AUTOSUGGEST_BIND_COUNTS[$1]
else else
bind_count=0 typeset -gi bind_count=0
fi fi
} }
@ -257,7 +257,7 @@ _zsh_autosuggest_highlight_apply() {
typeset -g _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT typeset -g _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT
if [ $#POSTDISPLAY -gt 0 ]; then if [ $#POSTDISPLAY -gt 0 ]; then
_ZSH_AUTOSUGGEST_LAST_HIGHLIGHT="$#BUFFER $(($#BUFFER + $#POSTDISPLAY)) $ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE" typeset -g _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT="$#BUFFER $(($#BUFFER + $#POSTDISPLAY)) $ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE"
region_highlight+=("$_ZSH_AUTOSUGGEST_LAST_HIGHLIGHT") region_highlight+=("$_ZSH_AUTOSUGGEST_LAST_HIGHLIGHT")
else else
unset _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT unset _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT
@ -482,7 +482,7 @@ _zsh_autosuggest_strategy_default() {
# Get the history items that match # Get the history items that match
# - (r) subscript flag makes the pattern match on values # - (r) subscript flag makes the pattern match on values
suggestion="${history[(r)${(b)prefix}*]}" typeset -g suggestion="${history[(r)${(b)prefix}*]}"
} }
#--------------------------------------------------------------------# #--------------------------------------------------------------------#
@ -534,7 +534,7 @@ _zsh_autosuggest_strategy_match_prev_cmd() {
done done
# Give back the matched history entry # Give back the matched history entry
suggestion="$history[$histkey]" typeset -g suggestion="$history[$histkey]"
} }
#--------------------------------------------------------------------# #--------------------------------------------------------------------#