mirror of
				https://github.com/zsh-users/zsh-syntax-highlighting.git
				synced 2025-10-30 15:56:28 +08:00 
			
		
		
		
	main: Avoid empty character classes
Avoids an error in pre-5.0.8: bad pattern: -[]#
This commit is contained in:
		
							parent
							
								
									07f259f653
								
							
						
					
					
						commit
						31276c1b64
					
				| @ -608,17 +608,20 @@ _zsh_highlight_main_highlighter_highlight_list() | |||||||
|     if (( ! in_redirection )); then |     if (( ! in_redirection )); then | ||||||
|       if [[ $this_word == *':sudo_opt:'* ]]; then |       if [[ $this_word == *':sudo_opt:'* ]]; then | ||||||
|         if [[ -n $flags_with_argument ]] && |         if [[ -n $flags_with_argument ]] && | ||||||
|            [[ $arg == '-'[$flags_sans_argument]#[$flags_with_argument] ]]; then |            { [[ -n $flags_sans_argument ]] && [[ $arg == '-'[$flags_sans_argument]#[$flags_with_argument] ]] || | ||||||
|  |              [[ $arg == '-'[$flags_with_argument] ]] }; then | ||||||
|           # Flag that requires an argument |           # Flag that requires an argument | ||||||
|           this_word=${this_word//:start:/} |           this_word=${this_word//:start:/} | ||||||
|           next_word=':sudo_arg:' |           next_word=':sudo_arg:' | ||||||
|         elif [[ -n $flags_with_argument ]] && |         elif [[ -n $flags_with_argument ]] && | ||||||
|              [[ $arg == '-'[$flags_sans_argument]#[$flags_with_argument]* ]]; then |              { [[ -n $flags_sans_argument ]] && [[ $arg == '-'[$flags_sans_argument]#[$flags_with_argument]* ]] || | ||||||
|  |                [[ $arg == '-'[$flags_with_argument]* ]] }; then | ||||||
|           # Argument attached in the same word |           # Argument attached in the same word | ||||||
|           this_word=${this_word//:start:/} |           this_word=${this_word//:start:/} | ||||||
|           next_word+=':start:' |           next_word+=':start:' | ||||||
|           next_word+=':sudo_opt:' |           next_word+=':sudo_opt:' | ||||||
|         elif [[ $arg == '-'[$flags_sans_argument]# ]]; then |         elif [[ -n $flags_sans_argument ]] && | ||||||
|  |              [[ $arg == '-'[$flags_sans_argument]# ]]; then | ||||||
|           # Flag that requires no argument |           # Flag that requires no argument | ||||||
|           this_word=:sudo_opt: |           this_word=:sudo_opt: | ||||||
|           next_word+=':start:' |           next_word+=':start:' | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Matthew Martin
						Matthew Martin