|
@ -273,7 +273,6 @@ _zsh_highlight_main_highlighter() |
|
|
# which add the entry early so escape sequences within the string override |
|
|
# which add the entry early so escape sequences within the string override |
|
|
# the string's color. |
|
|
# the string's color. |
|
|
integer already_added=0 |
|
|
integer already_added=0 |
|
|
local style_override="" |
|
|
|
|
|
if [[ $this_word == *':start:'* ]]; then |
|
|
if [[ $this_word == *':start:'* ]]; then |
|
|
in_array_assignment=false |
|
|
in_array_assignment=false |
|
|
if [[ $arg == 'noglob' ]]; then |
|
|
if [[ $arg == 'noglob' ]]; then |
|
@ -458,7 +457,7 @@ _zsh_highlight_main_highlighter() |
|
|
style=reserved-word |
|
|
style=reserved-word |
|
|
else |
|
|
else |
|
|
if _zsh_highlight_main_highlighter_check_path; then |
|
|
if _zsh_highlight_main_highlighter_check_path; then |
|
|
style=path |
|
|
|
|
|
|
|
|
style=$REPLY |
|
|
else |
|
|
else |
|
|
style=unknown-token |
|
|
style=unknown-token |
|
|
fi |
|
|
fi |
|
@ -509,7 +508,7 @@ _zsh_highlight_main_highlighter() |
|
|
(( in_redirection=2 )) |
|
|
(( in_redirection=2 )) |
|
|
else |
|
|
else |
|
|
if _zsh_highlight_main_highlighter_check_path; then |
|
|
if _zsh_highlight_main_highlighter_check_path; then |
|
|
style=path |
|
|
|
|
|
|
|
|
style=$REPLY |
|
|
else |
|
|
else |
|
|
style=default |
|
|
style=default |
|
|
fi |
|
|
fi |
|
@ -517,8 +516,6 @@ _zsh_highlight_main_highlighter() |
|
|
;; |
|
|
;; |
|
|
esac |
|
|
esac |
|
|
fi |
|
|
fi |
|
|
# if a style_override was set (eg in _zsh_highlight_main_highlighter_check_path), use it |
|
|
|
|
|
[[ -n $style_override ]] && style=$style_override |
|
|
|
|
|
if ! (( already_added )); then |
|
|
if ! (( already_added )); then |
|
|
_zsh_highlight_main_add_region_highlight $start_pos $end_pos $style |
|
|
_zsh_highlight_main_add_region_highlight $start_pos $end_pos $style |
|
|
[[ $style == path || $style == path_prefix ]] && _zsh_highlight_main_highlighter_highlight_path_separators |
|
|
[[ $style == path || $style == path_prefix ]] && _zsh_highlight_main_highlighter_highlight_path_separators |
|
@ -564,11 +561,15 @@ _zsh_highlight_main_highlighter_highlight_path_separators() |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
# Check if $arg is a path. |
|
|
# Check if $arg is a path. |
|
|
|
|
|
# If yes, return 0 and in $REPLY the style to use. |
|
|
|
|
|
# Else, return non-zero (and the contents of $REPLY is undefined). |
|
|
_zsh_highlight_main_highlighter_check_path() |
|
|
_zsh_highlight_main_highlighter_check_path() |
|
|
{ |
|
|
{ |
|
|
_zsh_highlight_main_highlighter_expand_path $arg; |
|
|
_zsh_highlight_main_highlighter_expand_path $arg; |
|
|
local expanded_path="$REPLY" |
|
|
local expanded_path="$REPLY" |
|
|
|
|
|
|
|
|
|
|
|
REPLY=path |
|
|
|
|
|
|
|
|
[[ -z $expanded_path ]] && return 1 |
|
|
[[ -z $expanded_path ]] && return 1 |
|
|
[[ -e $expanded_path ]] && return 0 |
|
|
[[ -e $expanded_path ]] && return 0 |
|
|
|
|
|
|
|
@ -586,7 +587,7 @@ _zsh_highlight_main_highlighter_check_path() |
|
|
[[ $WIDGET != accept-* ]]; then |
|
|
[[ $WIDGET != accept-* ]]; then |
|
|
local -a tmp |
|
|
local -a tmp |
|
|
tmp=( ${expanded_path}*(N) ) |
|
|
tmp=( ${expanded_path}*(N) ) |
|
|
(( $#tmp > 0 )) && style_override=path_prefix && return 0 |
|
|
|
|
|
|
|
|
(( $#tmp > 0 )) && REPLY=path_prefix && return 0 |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
# It's not a path. |
|
|
# It's not a path. |
|
|