@@ -271,7 +271,6 @@ _zsh_highlight_main_highlighter()
271
271
# which add the entry early so escape sequences within the string override
272
272
# the string's color.
273
273
integer already_added=0
274
- local style_override=" "
275
274
if [[ $this_word == * ' :start:' * ]]; then
276
275
in_array_assignment=false
277
276
if [[ $arg == ' noglob' ]]; then
@@ -456,7 +455,7 @@ _zsh_highlight_main_highlighter()
456
455
style=reserved-word
457
456
else
458
457
if _zsh_highlight_main_highlighter_check_path; then
459
- style=path
458
+ style=$REPLY
460
459
else
461
460
style=unknown-token
462
461
fi
@@ -507,16 +506,14 @@ _zsh_highlight_main_highlighter()
507
506
(( in_redirection= 2 ))
508
507
else
509
508
if _zsh_highlight_main_highlighter_check_path; then
510
- style=path
509
+ style=$REPLY
511
510
else
512
511
style=default
513
512
fi
514
513
fi
515
514
;;
516
515
esac
517
516
fi
518
- # if a style_override was set (eg in _zsh_highlight_main_highlighter_check_path), use it
519
- [[ -n $style_override ]] && style=$style_override
520
517
(( already_added )) || _zsh_highlight_main_add_region_highlight $start_pos $end_pos $style
521
518
if [[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_COMMANDSEPARATOR:# " $arg " } ]]; then
522
519
next_word=' :start:'
@@ -547,11 +544,15 @@ _zsh_highlight_main_highlighter_check_assign()
547
544
}
548
545
549
546
# Check if $arg is a path.
547
+ # If yes, return 0 and in $REPLY the style to use.
548
+ # Else, return non-zero (and the contents of $REPLY is undefined).
550
549
_zsh_highlight_main_highlighter_check_path ()
551
550
{
552
551
_zsh_highlight_main_highlighter_expand_path $arg ;
553
552
local expanded_path=" $REPLY "
554
553
554
+ REPLY=path
555
+
555
556
[[ -z $expanded_path ]] && return 1
556
557
[[ -e $expanded_path ]] && return 0
557
558
@@ -569,7 +570,7 @@ _zsh_highlight_main_highlighter_check_path()
569
570
[[ $WIDGET != accept-* ]]; then
570
571
local -a tmp
571
572
tmp=( ${expanded_path} * (N) )
572
- (( $# tmp > 0 )) && style_override =path_prefix && return 0
573
+ (( $# tmp > 0 )) && REPLY =path_prefix && return 0
573
574
fi
574
575
575
576
# It's not a path.
0 commit comments