sudo: Highlight an empty `sudo;` as an error.
The word following 'sudo' was considered :regular:, although it isn't.
This commit is contained in:
		
							parent
							
								
									86e9249709
								
							
						
					
					
						commit
						a3047a9121
					
				|  | @ -206,6 +206,7 @@ _zsh_highlight_main_highlighter() | ||||||
|      elif [[ "$arg" = "sudo" ]]; then |      elif [[ "$arg" = "sudo" ]]; then | ||||||
|       style=$ZSH_HIGHLIGHT_STYLES[precommand] |       style=$ZSH_HIGHLIGHT_STYLES[precommand] | ||||||
|       next_word+=':sudo_opt:' |       next_word+=':sudo_opt:' | ||||||
|  |       next_word=${next_word//:regular:/} | ||||||
|      else |      else | ||||||
|       _zsh_highlight_main_highlighter_expand_path $arg |       _zsh_highlight_main_highlighter_expand_path $arg | ||||||
|       local expanded_arg="$REPLY" |       local expanded_arg="$REPLY" | ||||||
|  |  | ||||||
|  | @ -32,7 +32,7 @@ ZSH_HIGHLIGHT_STYLES[single-hyphen-option]=$unused_highlight | ||||||
| # * -i  (no argument) | # * -i  (no argument) | ||||||
| # * -C3 (pasted argument) | # * -C3 (pasted argument) | ||||||
| # * -u otheruser (non-pasted argument) | # * -u otheruser (non-pasted argument) | ||||||
| BUFFER='sudo -C3 -u otheruser -i ls /' | BUFFER='sudo -C3 -u otheruser -i ls /; sudo ;' | ||||||
| 
 | 
 | ||||||
| expected_region_highlight=( | expected_region_highlight=( | ||||||
|   "1 4 $ZSH_HIGHLIGHT_STYLES[precommand]" # sudo |   "1 4 $ZSH_HIGHLIGHT_STYLES[precommand]" # sudo | ||||||
|  | @ -42,4 +42,5 @@ expected_region_highlight=( | ||||||
|   "23 24 $ZSH_HIGHLIGHT_STYLES[single-hyphen-option]" # -i |   "23 24 $ZSH_HIGHLIGHT_STYLES[single-hyphen-option]" # -i | ||||||
|   "26 27 $ZSH_HIGHLIGHT_STYLES[command]" # ls |   "26 27 $ZSH_HIGHLIGHT_STYLES[command]" # ls | ||||||
|   "29 29 $ZSH_HIGHLIGHT_STYLES[path]" # / |   "29 29 $ZSH_HIGHLIGHT_STYLES[path]" # / | ||||||
|  |   "37 37 $ZSH_HIGHLIGHT_STYLES[unknown-token]" # ;, error because empty command | ||||||
| ) | ) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue