This commit is contained in:
m0vie 2026-02-19 16:38:07 -08:00 committed by GitHub
commit 4cb796ca78
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 72 additions and 4 deletions

View file

@ -1349,7 +1349,7 @@ _zsh_highlight_main_highlighter_highlight_argument()
# This loop is a hot path. Keep it fast!
(( --i ))
while (( ++i <= $#arg )); do
i=${arg[(ib.i.)[\\\'\"\`\$\<\>\*\?]]}
i=${arg[(ib.i.)[\\\'\"\`\$\<\>\*\?\[\(\^\#]]}
case "$arg[$i]" in
"") break;;
"\\") (( i += 1 )); continue;;
@ -1426,7 +1426,13 @@ _zsh_highlight_main_highlighter_highlight_argument()
*)
if $highlight_glob &&
[[ $zsyh_user_options[multios] == on || $in_redirection -eq 0 ]] &&
[[ ${arg[$i]} =~ ^[*?] || ${arg:$i-1} =~ ^\<[0-9]*-[0-9]*\> ]]; then
[[ ${arg[$i]} =~ ^[*?] ||
${arg:$i-1} =~ ^\\[[^\]]+\\] ||
${arg:$i-1} =~ ^\\\([^\)]*\\\). || ${arg:$i-1} =~ ^\\\([^\)]*\\\|[^\)]*\\\)$ ||
${arg:$i-1} =~ ^\<[0-9]*-[0-9]*\> ||
$zsyh_user_options[extendedglob] == on && ${arg[$i]} =~ \\\^ ||
$zsyh_user_options[extendedglob] == on && ${arg[$i]} =~ \\\#
]]; then
highlights+=($(( start_pos + i - 1 )) $(( start_pos + i + $#MATCH - 1)) globbing)
(( i += $#MATCH - 1 ))
path_eligible=0