* remove a safety belt - no need to check if array has elements, as defaults are provided
* reuse $pos instead of using another variable * remove declaration forgotten in last commit
This commit is contained in:
		
							parent
							
								
									d4acac9837
								
							
						
					
					
						commit
						05e4a031c7
					
				|  | @ -46,10 +46,8 @@ _zsh_highlight_brackets_highlighter_predicate() | ||||||
| # Brackets highlighting function. | # Brackets highlighting function. | ||||||
| _zsh_highlight_brackets_highlighter() | _zsh_highlight_brackets_highlighter() | ||||||
| { | { | ||||||
|   local bracket_color_size=${#ZSH_HIGHLIGHT_STYLES[(I)bracket-level-*]} |   local level pos | ||||||
|   if ((bracket_color_size > 0)); then |   local -A levelpos lastoflevel matching typepos | ||||||
|     local c level pos |  | ||||||
|     typeset -A levelpos lastoflevel matching typepos revmatching |  | ||||||
|   ((level = 0)) |   ((level = 0)) | ||||||
|   for pos in {1..${#BUFFER}}; do |   for pos in {1..${#BUFFER}}; do | ||||||
|     case $BUFFER[pos] in |     case $BUFFER[pos] in | ||||||
|  | @ -75,16 +73,16 @@ _zsh_highlight_brackets_highlighter() | ||||||
|     if [[ -z $matching[$pos] ]] || [[ $typepos[$pos] != $typepos[$matching[$pos]] ]]; then |     if [[ -z $matching[$pos] ]] || [[ $typepos[$pos] != $typepos[$matching[$pos]] ]]; then | ||||||
|       region_highlight+=("$((pos - 1)) $pos "$ZSH_HIGHLIGHT_STYLES[bracket-error]) |       region_highlight+=("$((pos - 1)) $pos "$ZSH_HIGHLIGHT_STYLES[bracket-error]) | ||||||
|     else |     else | ||||||
|  |       local bracket_color_size=${#ZSH_HIGHLIGHT_STYLES[(I)bracket-level-*]} | ||||||
|       local style=bracket-level-$(( (levelpos[$pos] - 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]) |       region_highlight+=("$((pos - 1)) $pos "$ZSH_HIGHLIGHT_STYLES[$style]) | ||||||
|     fi |     fi | ||||||
|   done |   done | ||||||
|     ((c = CURSOR + 1)) |   ((pos = CURSOR + 1)) | ||||||
|     if [[ -n $levelpos[$c] ]]; then |   if [[ -n $levelpos[$pos] ]]; then | ||||||
|     local otherpos |     local otherpos | ||||||
|     ((otherpos = -1)) |     ((otherpos = -1)) | ||||||
|       [[ -n $matching[$c] ]] && otherpos=$matching[$c] |     [[ -n $matching[$pos] ]] && otherpos=$matching[$pos] | ||||||
|     region_highlight+=("$((otherpos - 1)) $otherpos standout") |     region_highlight+=("$((otherpos - 1)) $otherpos standout") | ||||||
|   fi |   fi | ||||||
|   fi |  | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue