Revert "*-highlight: Use [[ -v ... ]] test instead of $parameters"

This reverts commit aff7531bfa.

Plus also the same change for the math mode highlighting.

Issue #152
This commit is contained in:
Sebastian Gniazdowski 2019-08-21 22:10:00 +02:00
parent 581e75761c
commit c75ee58003

View file

@ -611,9 +611,10 @@ typeset -ga ZLAST_COMMANDS
(( next_word = (next_word & ~2) | 4 | 1 ))
else
_mybuf=${${(Q)__arg}#\"}
if [[ $_mybuf = (#b)(*)(*)\$([a-zA-Z_][a-zA-Z0-9_]#|[0-9]##)(*) || \
if (( ${+parameters} )) && \
[[ $_mybuf = (#b)(*)(*)\$([a-zA-Z_][a-zA-Z0-9_]#|[0-9]##)(*) || \
$_mybuf = (#b)(*)(*)\$\{([a-zA-Z_][a-zA-Z0-9_:-]#|[0-9]##)(*) ]] && \
[[ -v ${match[3]%%:-*} ]]
(( ${+parameters[${match[3]%%:-*}]} ))
then
-fast-highlight-main-type ${match[1]}${match[2]}${(P)match[3]%%:-*}${match[4]#\}}
elif [[ $braces_stack = T* ]]; then # T - typedef, etc.
@ -1342,7 +1343,7 @@ zle -N -- fast-highlight-check-path-handler -fast-highlight-check-path-handler
[[ ${match[1]} = [0-9]* ]] && __style=${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}mathnum]} || {
[[ ${match[1]} = [a-zA-Z_]* ]] && {
[[ -v ${match[1]} || ${FAST_ASSIGNS_SEEN[${match[1]}]} = 1 ]] && \
[[ ${+parameters[${match[1]}]} = 1 || ${FAST_ASSIGNS_SEEN[${match[1]}]} = 1 ]] && \
__style=${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}mathvar]} || \
__style=${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}matherr]}
} || {