sudo: Tweak state computations.
This causes the ':start:' state to be set in $next_word in iteration N-1, rather than to only be added to $this_word in iteration N.
This commit is contained in:
		
							parent
							
								
									f49f3bf0c0
								
							
						
					
					
						commit
						9cb87473cc
					
				|  | @ -192,11 +192,14 @@ _zsh_highlight_main_highlighter() | ||||||
|           '-'[Cgprtu]) this_word=${this_word//:start:/}; |           '-'[Cgprtu]) this_word=${this_word//:start:/}; | ||||||
|                        next_word=':sudo_arg:';; |                        next_word=':sudo_arg:';; | ||||||
|           # This prevents misbehavior with sudo -u -otherargument |           # This prevents misbehavior with sudo -u -otherargument | ||||||
|           '-'*)        next_word+=':sudo_opt:';; |           '-'*)        this_word=${this_word//:start:/}; | ||||||
|           *)           this_word+=':start:';; |                        next_word+=':start:'; | ||||||
|  |                        next_word+=':sudo_opt:';; | ||||||
|  |           *)           ;; | ||||||
|         esac |         esac | ||||||
|       elif [[ $this_word == *':sudo_arg:'* ]]; then |       elif [[ $this_word == *':sudo_arg:'* ]]; then | ||||||
|         next_word+=':sudo_opt:' |         next_word+=':sudo_opt:' | ||||||
|  |         next_word+=':start:' | ||||||
|       fi |       fi | ||||||
|     fi |     fi | ||||||
| 
 | 
 | ||||||
|  | @ -205,8 +208,9 @@ _zsh_highlight_main_highlighter() | ||||||
|       style=$ZSH_HIGHLIGHT_STYLES[precommand] |       style=$ZSH_HIGHLIGHT_STYLES[precommand] | ||||||
|      elif [[ "$arg" = "sudo" ]]; then |      elif [[ "$arg" = "sudo" ]]; then | ||||||
|       style=$ZSH_HIGHLIGHT_STYLES[precommand] |       style=$ZSH_HIGHLIGHT_STYLES[precommand] | ||||||
|       next_word+=':sudo_opt:' |  | ||||||
|       next_word=${next_word//:regular:/} |       next_word=${next_word//:regular:/} | ||||||
|  |       next_word+=':sudo_opt:' | ||||||
|  |       next_word+=':start:' | ||||||
|      else |      else | ||||||
|       _zsh_highlight_main_highlighter_expand_path $arg |       _zsh_highlight_main_highlighter_expand_path $arg | ||||||
|       local expanded_arg="$REPLY" |       local expanded_arg="$REPLY" | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue