'main': Permit $flags_with_argument to be empty.
This commit is contained in:
		
							parent
							
								
									be63ff7e12
								
							
						
					
					
						commit
						b8c955d164
					
				| 
						 | 
					@ -505,17 +505,20 @@ _zsh_highlight_highlighter_main_paint()
 | 
				
			||||||
    # Parse the sudo command line
 | 
					    # Parse the sudo command line
 | 
				
			||||||
    if (( ! in_redirection )); then
 | 
					    if (( ! in_redirection )); then
 | 
				
			||||||
      if [[ $this_word == *':sudo_opt:'* ]]; then
 | 
					      if [[ $this_word == *':sudo_opt:'* ]]; then
 | 
				
			||||||
        case "$arg" in
 | 
					        if [[ -n $flags_with_argument ]] &&
 | 
				
			||||||
 | 
					           [[ $arg == '-'[$flags_with_argument] ]]; then
 | 
				
			||||||
          # Flag that requires an argument
 | 
					          # Flag that requires an argument
 | 
				
			||||||
          '-'[$flags_with_argument])
 | 
					          this_word=${this_word//:start:/}
 | 
				
			||||||
                       this_word=${this_word//:start:/};
 | 
					          next_word=':sudo_arg:'
 | 
				
			||||||
                       next_word=':sudo_arg:';;
 | 
					        elif [[ $arg == '-'* ]]; then
 | 
				
			||||||
 | 
					          # Flag that requires no argument, or unknown flag.
 | 
				
			||||||
          # This prevents misbehavior with sudo -u -otherargument
 | 
					          # This prevents misbehavior with sudo -u -otherargument
 | 
				
			||||||
          '-'*)        this_word=${this_word//:start:/};
 | 
					          this_word=${this_word//:start:/}
 | 
				
			||||||
                       next_word+=':start:';
 | 
					          next_word+=':start:'
 | 
				
			||||||
                       next_word+=':sudo_opt:';;
 | 
					          next_word+=':sudo_opt:'
 | 
				
			||||||
          *)           ;;
 | 
					        else
 | 
				
			||||||
        esac
 | 
					          #
 | 
				
			||||||
 | 
					        fi
 | 
				
			||||||
      elif [[ $this_word == *':sudo_arg:'* ]]; then
 | 
					      elif [[ $this_word == *':sudo_arg:'* ]]; then
 | 
				
			||||||
        next_word+=':sudo_opt:'
 | 
					        next_word+=':sudo_opt:'
 | 
				
			||||||
        next_word+=':start:'
 | 
					        next_word+=':start:'
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue