Merge pull request #62 from garinger/master
Fix for Issue #35 "Unclosed brackets not marked as error"
This commit is contained in:
		
						commit
						eb749f2681
					
				|  | @ -46,8 +46,9 @@ _zsh_highlight_brackets_highlighter_predicate() | ||||||
| # Brackets highlighting function. | # Brackets highlighting function. | ||||||
| _zsh_highlight_brackets_highlighter() | _zsh_highlight_brackets_highlighter() | ||||||
| { | { | ||||||
|   bracket_color_size=${#ZSH_HIGHLIGHT_STYLES[(I)bracket-level-*]} |   local bracket_color_size=${#ZSH_HIGHLIGHT_STYLES[(I)bracket-level-*]} | ||||||
|   if ((bracket_color_size > 0)); then |   if ((bracket_color_size > 0)); then | ||||||
|  |     local c level pos | ||||||
|     typeset -A levelpos lastoflevel matching revmatching |     typeset -A levelpos lastoflevel matching revmatching | ||||||
|     ((level = 0)) |     ((level = 0)) | ||||||
|     for pos in {1..${#BUFFER}}; do |     for pos in {1..${#BUFFER}}; do | ||||||
|  | @ -64,15 +65,16 @@ _zsh_highlight_brackets_highlighter() | ||||||
|       esac |       esac | ||||||
|     done |     done | ||||||
|     for pos in ${(k)levelpos}; do |     for pos in ${(k)levelpos}; do | ||||||
|       level=$levelpos[$pos] |       if [[ -z $matching[$pos] ]] && [[ -z $revmatching[$pos] ]]; then | ||||||
|       if ((level < 1)); then |  | ||||||
|         region_highlight+=("$((pos - 1)) $pos "$ZSH_HIGHLIGHT_STYLES[bracket-error]) |         region_highlight+=("$((pos - 1)) $pos "$ZSH_HIGHLIGHT_STYLES[bracket-error]) | ||||||
|       else |       else | ||||||
|         region_highlight+=("$((pos - 1)) $pos "$ZSH_HIGHLIGHT_STYLES[bracket-level-$(( (level - 1) % bracket_color_size + 1 ))]) |         local style=bracket-level-$(( (levelpos[$pos] - 1) % bracket_color_size + 1 )) | ||||||
|  |         region_highlight+=("$((pos - 1)) $pos "$ZSH_HIGHLIGHT_STYLES[$style]) | ||||||
|       fi |       fi | ||||||
|     done |     done | ||||||
|     ((c = CURSOR + 1)) |     ((c = CURSOR + 1)) | ||||||
|     if [[ -n $levelpos[$c] ]]; then |     if [[ -n $levelpos[$c] ]]; then | ||||||
|  |       local otherpos | ||||||
|       ((otherpos = -1)) |       ((otherpos = -1)) | ||||||
|       [[ -n $matching[$c] ]] && otherpos=$matching[$c] |       [[ -n $matching[$c] ]] && otherpos=$matching[$c] | ||||||
|       [[ -n $revmatching[$c] ]] && otherpos=$revmatching[$c] |       [[ -n $revmatching[$c] ]] && otherpos=$revmatching[$c] | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue