mirror of
https://github.com/zsh-users/zsh-syntax-highlighting.git
synced 2025-02-13 10:05:31 +08:00
Prevent matching of command prefix if path is written explicitly. This solves issue that prefix '/l' matches '/bin//ls' (with two slashes what is valid syntax for zsh).
This commit is contained in:
parent
f728546b74
commit
25b83ca8a9
@ -171,7 +171,7 @@ _zsh_highlight_main_highlighter()
|
|||||||
else
|
else
|
||||||
style=$ZSH_HIGHLIGHT_STYLES[unknown-token]
|
style=$ZSH_HIGHLIGHT_STYLES[unknown-token]
|
||||||
fi
|
fi
|
||||||
_zsh_highlight_main_highlighter_check_file && isfile=true
|
_zsh_highlight_main_highlighter_check_file && isfile=true
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
@ -290,6 +290,7 @@ _zsh_highlight_main_highlighter_check_command()
|
|||||||
{
|
{
|
||||||
setopt localoptions nonomatch
|
setopt localoptions nonomatch
|
||||||
local -a prefixed_command
|
local -a prefixed_command
|
||||||
|
[[ $arg != $arg:t ]] && return 1 # don't match anything if explicit path is present
|
||||||
for p in $path; do prefixed_command+=( $p/${arg}*(N) ); done
|
for p in $path; do prefixed_command+=( $p/${arg}*(N) ); done
|
||||||
[[ ${BUFFER[1]} != "-" && ${#LBUFFER} == $end_pos && $#prefixed_command > 0 ]] && return 0 || return 1
|
[[ ${BUFFER[1]} != "-" && ${#LBUFFER} == $end_pos && $#prefixed_command > 0 ]] && return 0 || return 1
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user