Skip to content

Commit

Permalink
'brackets': Use one-based indexing
Browse files Browse the repository at this point in the history
zsh arrays start at one, and this will make the next commit easier.
  • Loading branch information
phy1729 committed May 5, 2016
1 parent f4d3dcb commit 95d8256
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions highlighters/brackets/brackets-highlighter.zsh
Expand Up @@ -51,8 +51,8 @@ _zsh_highlight_brackets_highlighter()
local -A levelpos lastoflevel matching typepos

# Find all brackets and remember which one is matching
for (( pos = 0; pos < buflen; pos++ )) ; do
char="$BUFFER[pos+1]"
for (( pos = 1; pos <= buflen; pos++ )) ; do
char=$BUFFER[pos]
case $char in
["([{"])
levelpos[$pos]=$((++level))
Expand Down Expand Up @@ -83,7 +83,7 @@ _zsh_highlight_brackets_highlighter()
else
style=bracket-error
fi
_zsh_highlight_add_highlight $pos $((pos + 1)) $style
_zsh_highlight_add_highlight $((pos - 1)) $pos $style
done

# If cursor is on a bracket, then highlight corresponding bracket, if any
Expand Down

0 comments on commit 95d8256

Please sign in to comment.