'brackets': Use one-based indexing
zsh arrays start at one, and this will make the next commit easier.
This commit is contained in:
		
							parent
							
								
									f4d3dcb42f
								
							
						
					
					
						commit
						95d82568d8
					
				|  | @ -51,8 +51,8 @@ _zsh_highlight_brackets_highlighter() | ||||||
|   local -A levelpos lastoflevel matching typepos |   local -A levelpos lastoflevel matching typepos | ||||||
| 
 | 
 | ||||||
|   # Find all brackets and remember which one is matching |   # Find all brackets and remember which one is matching | ||||||
|   for (( pos = 0; pos < buflen; pos++ )) ; do |   for (( pos = 1; pos <= buflen; pos++ )) ; do | ||||||
|     char="$BUFFER[pos+1]" |     char=$BUFFER[pos] | ||||||
|     case $char in |     case $char in | ||||||
|       ["([{"]) |       ["([{"]) | ||||||
|         levelpos[$pos]=$((++level)) |         levelpos[$pos]=$((++level)) | ||||||
|  | @ -83,7 +83,7 @@ _zsh_highlight_brackets_highlighter() | ||||||
|     else |     else | ||||||
|       style=bracket-error |       style=bracket-error | ||||||
|     fi |     fi | ||||||
|     _zsh_highlight_add_highlight $pos $((pos + 1)) $style |     _zsh_highlight_add_highlight $((pos - 1)) $pos $style | ||||||
|   done |   done | ||||||
| 
 | 
 | ||||||
|   # If cursor is on a bracket, then highlight corresponding bracket, if any |   # If cursor is on a bracket, then highlight corresponding bracket, if any | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue