'brackets': Allow unset ZSH_HIGHLIGHT_STYLES

Without this when bracket_color_size is 0,
    $(( (levelpos[$pos] - 1) % bracket_color_size + 1 ))
errors with division by zero.
This commit is contained in:
Matthew Martin 2016-01-20 00:38:44 -06:00
parent eaa4335c34
commit f73f3d53d3

View File

@ -76,7 +76,9 @@ _zsh_highlight_brackets_highlighter()
# Now highlight all found brackets # Now highlight all found brackets
for pos in ${(k)levelpos}; do for pos in ${(k)levelpos}; do
if (( $+matching[$pos] )); then if (( $+matching[$pos] )); then
if (( bracket_color_size )); then
style=bracket-level-$(( (levelpos[$pos] - 1) % bracket_color_size + 1 )) style=bracket-level-$(( (levelpos[$pos] - 1) % bracket_color_size + 1 ))
fi
else else
style=bracket-error style=bracket-error
fi fi