Fix bracket highlighter

This commit is contained in:
Jan M. Binder 2012-04-07 17:09:15 +02:00
parent 966eb851ca
commit 732b7d6e65

View File

@ -52,18 +52,18 @@ _zsh_highlight_brackets_highlighter()
# Find all brackets and remember which one is matching # Find all brackets and remember which one is matching
for (( pos = 0; $pos < ${#BUFFER}; pos++ )) ; do for (( pos = 0; $pos < ${#BUFFER}; pos++ )) ; do
local char=$BUFFER[pos+1] local char="$BUFFER[pos+1]"
case $char in case $char in
["([{"]) ["([{"])
levelpos[$pos]=$((++level)) levelpos[$pos]=$((++level))
lastoflevel[$level]=$pos lastoflevel[$level]=$pos
_zsh_highlight_brackets_highlighter_brackettype $char _zsh_highlight_brackets_highlighter_brackettype "$char"
;; ;;
[")]}"]) [")]}"])
matching[$lastoflevel[$level]]=$pos matching[$lastoflevel[$level]]=$pos
matching[$pos]=$lastoflevel[$level] matching[$pos]=$lastoflevel[$level]
levelpos[$pos]=$((level--)) levelpos[$pos]=$((level--))
_zsh_highlight_brackets_highlighter_brackettype $char _zsh_highlight_brackets_highlighter_brackettype "$char"
;; ;;
['"'\']) ['"'\'])
# Skip everything inside quotes # Skip everything inside quotes