mirror of
https://github.com/zsh-users/zsh-syntax-highlighting.git
synced 2025-12-04 21:56:45 +01:00
'main': Don't match redirection operators in command substitutions as <-> number range globs. Fixes #483.
This commit is contained in:
parent
901063aa0f
commit
0458b0c16f
3 changed files with 16 additions and 11 deletions
|
|
@ -801,6 +801,9 @@ _zsh_highlight_main_highlighter_highlight_argument()
|
|||
local i path_eligible style
|
||||
path_eligible=1
|
||||
|
||||
local -a match mbegin mend
|
||||
local MATCH; integer MBEGIN MEND
|
||||
|
||||
_zsh_highlight_main_add_region_highlight $start_pos $end_pos default
|
||||
for (( i = 1 ; i <= end_pos - start_pos ; i += 1 )); do
|
||||
case "$arg[$i]" in
|
||||
|
|
@ -822,14 +825,16 @@ _zsh_highlight_main_highlighter_highlight_argument()
|
|||
elif [[ $arg[i+1] == [*@#?-$!] ]]; then
|
||||
(( i += 1 ))
|
||||
fi;;
|
||||
[*?]|\<)
|
||||
# The '<' is for the <-> globbing syntax. (This function doesn't get called on redirection tokens.)
|
||||
if $highlight_glob; then
|
||||
*)
|
||||
if $highlight_glob && [[ ${arg[$i]} == [*?] || ${arg:$i-1} == \<[0-9]#-[0-9]#\>* ]]; then
|
||||
(( i += $#MATCH - 1 ))
|
||||
_zsh_highlight_main_add_region_highlight $start_pos $end_pos globbing
|
||||
path_eligible=0
|
||||
break
|
||||
fi;;
|
||||
*) continue;;
|
||||
else
|
||||
continue
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue