mirror of
				https://github.com/zsh-users/zsh-syntax-highlighting.git
				synced 2025-10-31 01:55:07 +00:00 
			
		
		
		
	main: consume trailing whitespace in _highlight_list
Fixes highlighting when an unclosed $( ends in whitespace.
This commit is contained in:
		
							parent
							
								
									48a20d067f
								
							
						
					
					
						commit
						d9e326b993
					
				| @ -881,7 +881,8 @@ _zsh_highlight_main_highlighter_highlight_list() | |||||||
|     fi |     fi | ||||||
|     _zsh_highlight_main_add_region_highlight $start_pos $end_pos $style |     _zsh_highlight_main_add_region_highlight $start_pos $end_pos $style | ||||||
|   done |   done | ||||||
|   REPLY=$(( end_pos - 1 )) |   [[ "$proc_buf" = (#b)(#s)(([[:space:]]|\\$'\n')#) ]] | ||||||
|  |   REPLY=$(( end_pos + ${#match[1]} - 1 )) | ||||||
|   reply=($list_highlights) |   reply=($list_highlights) | ||||||
|   return $(( $#braces_stack > 0 )) |   return $(( $#braces_stack > 0 )) | ||||||
| } | } | ||||||
|  | |||||||
| @ -41,4 +41,5 @@ expected_region_highlight=( | |||||||
| 
 | 
 | ||||||
| if [[ ${(z):-'$('} == '$( ' ]]; then # ignore zsh 5.0.8 bug | if [[ ${(z):-'$('} == '$( ' ]]; then # ignore zsh 5.0.8 bug | ||||||
|   expected_region_highlight[2]='3 16 default' # foo$(echo bar |   expected_region_highlight[2]='3 16 default' # foo$(echo bar | ||||||
|  |   expected_region_highlight[3]='6 16 command-substitution-unquoted' # $(echo bar | ||||||
| fi | fi | ||||||
|  | |||||||
| @ -47,4 +47,5 @@ expected_region_highlight=( | |||||||
| 
 | 
 | ||||||
| if [[ ${(z):-'$('} == '$( ' ]]; then # ignore zsh 5.0.8 bug | if [[ ${(z):-'$('} == '$( ' ]]; then # ignore zsh 5.0.8 bug | ||||||
|   expected_region_highlight[8]='17 27 default' # =(echo foo |   expected_region_highlight[8]='17 27 default' # =(echo foo | ||||||
|  |   expected_region_highlight[9]='17 27 process-substitution' # =(echo foo | ||||||
| fi | fi | ||||||
|  | |||||||
| @ -32,12 +32,13 @@ BUFFER='echo "foo$(' | |||||||
| 
 | 
 | ||||||
| expected_region_highlight=( | expected_region_highlight=( | ||||||
|   '1 4 builtin' # echo |   '1 4 builtin' # echo | ||||||
|   '6 11 default' # "foo$( |   '6 12 default' # "foo$( | ||||||
|   '6 9 double-quoted-argument-unclosed' # "foo |   '6 9 double-quoted-argument-unclosed' # "foo | ||||||
|   '10 11 command-substitution-quoted' # $( |   '10 12 command-substitution-quoted' # $( | ||||||
|   '10 11 command-substitution-delimiter-quoted' # $( |   '10 11 command-substitution-delimiter-quoted' # $( | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| if [[ ${(z):-'$('} == '$( ' ]]; then # ignore zsh 5.0.8 bug | if [[ ${(z):-'$('} == '$( ' ]]; then # ignore zsh 5.0.8 bug | ||||||
|   expected_region_highlight[2]='6 12 default' # "foo$( |   expected_region_highlight[2]='6 13 default' # "foo$( | ||||||
|  |   expected_region_highlight[4]='10 13 command-substitution-quoted' # $( | ||||||
| fi | fi | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Matthew Martin
						Matthew Martin