main: Highlight non-matching globs as errors or normal
This commit is contained in:
parent
1e34c4aa0b
commit
fa98c97028
@ -978,7 +978,7 @@ _zsh_highlight_main_highlighter_check_path()
|
|||||||
_zsh_highlight_main_highlighter_highlight_argument()
|
_zsh_highlight_main_highlighter_highlight_argument()
|
||||||
{
|
{
|
||||||
local base_style=default i=$1 option_eligible=${2:-1} path_eligible=1 ret start style
|
local base_style=default i=$1 option_eligible=${2:-1} path_eligible=1 ret start style
|
||||||
local -a highlights
|
local -a globs highlights
|
||||||
|
|
||||||
local -a match mbegin mend
|
local -a match mbegin mend
|
||||||
local MATCH; integer MBEGIN MEND
|
local MATCH; integer MBEGIN MEND
|
||||||
@ -1087,6 +1087,7 @@ _zsh_highlight_main_highlighter_highlight_argument()
|
|||||||
highlights+=($(( start_pos + i - 1 )) $(( start_pos + i + $#MATCH - 1)) globbing)
|
highlights+=($(( start_pos + i - 1 )) $(( start_pos + i + $#MATCH - 1)) globbing)
|
||||||
(( i += $#MATCH - 1 ))
|
(( i += $#MATCH - 1 ))
|
||||||
path_eligible=0
|
path_eligible=0
|
||||||
|
globs+=($#highlights)
|
||||||
else
|
else
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
@ -1098,6 +1099,20 @@ _zsh_highlight_main_highlighter_highlight_argument()
|
|||||||
base_style=$REPLY
|
base_style=$REPLY
|
||||||
_zsh_highlight_main_highlighter_highlight_path_separators $base_style
|
_zsh_highlight_main_highlighter_highlight_path_separators $base_style
|
||||||
highlights+=($reply)
|
highlights+=($reply)
|
||||||
|
elif (( $#globs )); then
|
||||||
|
local glob
|
||||||
|
local -a files; files=($~arg(NY1))
|
||||||
|
if ! [[ -e $files[1] ]]; then
|
||||||
|
if [[ $zsyh_user_options[nomatch] == on ]]; then
|
||||||
|
for glob in $globs; do
|
||||||
|
highlights[glob]=unknown-token
|
||||||
|
done
|
||||||
|
else
|
||||||
|
for glob in $globs; do
|
||||||
|
unset "highlights[$glob - 2]" "highlights[glob - 1]" "highlights[glob]"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
highlights=($(( start_pos + $1 - 1 )) $end_pos $base_style $highlights)
|
highlights=($(( start_pos + $1 - 1 )) $end_pos $base_style $highlights)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user