From 25b83ca8a9725aace56ffb6523d2206fbc7b97b4 Mon Sep 17 00:00:00 2001 From: jimmijj Date: Sat, 4 Oct 2014 17:12:20 +0000 Subject: [PATCH] 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). --- highlighters/main/main-highlighter.zsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/highlighters/main/main-highlighter.zsh b/highlighters/main/main-highlighter.zsh index 00b6a88..711cf35 100755 --- a/highlighters/main/main-highlighter.zsh +++ b/highlighters/main/main-highlighter.zsh @@ -171,7 +171,7 @@ _zsh_highlight_main_highlighter() else style=$ZSH_HIGHLIGHT_STYLES[unknown-token] fi - _zsh_highlight_main_highlighter_check_file && isfile=true + _zsh_highlight_main_highlighter_check_file && isfile=true ;; esac fi @@ -290,6 +290,7 @@ _zsh_highlight_main_highlighter_check_command() { setopt localoptions nonomatch 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 [[ ${BUFFER[1]} != "-" && ${#LBUFFER} == $end_pos && $#prefixed_command > 0 ]] && return 0 || return 1 }