mirror of
				https://github.com/zsh-users/zsh-syntax-highlighting.git
				synced 2025-11-04 03:56:30 +00:00 
			
		
		
		
	'main': Permit $flags_with_argument to be empty.
This commit is contained in:
		
							parent
							
								
									6e8984e2ec
								
							
						
					
					
						commit
						add2ac59fc
					
				@ -545,17 +545,20 @@ _zsh_highlight_main_highlighter_highlight_list()
 | 
			
		||||
    # Parse the sudo command line
 | 
			
		||||
    if (( ! in_redirection )); 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
 | 
			
		||||
          '-'[$flags_with_argument])
 | 
			
		||||
                       this_word=${this_word//:start:/};
 | 
			
		||||
                       next_word=':sudo_arg:';;
 | 
			
		||||
          this_word=${this_word//:start:/}
 | 
			
		||||
          next_word=':sudo_arg:'
 | 
			
		||||
        elif [[ $arg == '-'* ]]; then
 | 
			
		||||
          # Flag that requires no argument, or unknown flag.
 | 
			
		||||
          # This prevents misbehavior with sudo -u -otherargument
 | 
			
		||||
          '-'*)        this_word=${this_word//:start:/};
 | 
			
		||||
                       next_word+=':start:';
 | 
			
		||||
                       next_word+=':sudo_opt:';;
 | 
			
		||||
          *)           ;;
 | 
			
		||||
        esac
 | 
			
		||||
          this_word=${this_word//:start:/}
 | 
			
		||||
          next_word+=':start:'
 | 
			
		||||
          next_word+=':sudo_opt:'
 | 
			
		||||
        else
 | 
			
		||||
          #
 | 
			
		||||
        fi
 | 
			
		||||
      elif [[ $this_word == *':sudo_arg:'* ]]; then
 | 
			
		||||
        next_word+=':sudo_opt:'
 | 
			
		||||
        next_word+=':start:'
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user