diff --git a/highlighters/main/main-highlighter.zsh b/highlighters/main/main-highlighter.zsh index 07049a9..e842128 100644 --- a/highlighters/main/main-highlighter.zsh +++ b/highlighters/main/main-highlighter.zsh @@ -212,6 +212,7 @@ _zsh_highlight_highlighter_main_paint() local -a options_to_set # used in callees local buf="$PREBUFFER$BUFFER" integer len="${#buf}" + integer pure_buf_len=$(( len - ${#PREBUFFER} )) # == $#BUFFER, used e.g. in *_check_path local braces_stack # "R" for round, "Q" for square, "Y" for curly @@ -701,7 +702,7 @@ _zsh_highlight_main_highlighter_check_path() [[ ! -d ${expanded_path:h} ]] && return 1 # If this word ends the buffer, check if it's the prefix of a valid path. - if [[ ${BUFFER[1]} != "-" && ${#BUFFER} == $end_pos ]] && + if [[ ${BUFFER[1]} != "-" && $pure_buf_len == $end_pos ]] && [[ $WIDGET != zle-line-finish ]]; then local -a tmp tmp=( ${expanded_path}*(N) )