diff --git a/highlighters/main/main-highlighter.zsh b/highlighters/main/main-highlighter.zsh index 42d19cc..166ae57 100644 --- a/highlighters/main/main-highlighter.zsh +++ b/highlighters/main/main-highlighter.zsh @@ -59,7 +59,9 @@ # Whether the highlighter should be called or not. _zsh_highlight_main_highlighter_predicate() { - _zsh_highlight_buffer_modified + # accept-* may trigger removal of path_prefix highlighting + [[ $WIDGET == accept-* ]] || + _zsh_highlight_buffer_modified } # Helper to deal with tokens crossing line boundaries. @@ -280,7 +282,8 @@ _zsh_highlight_main_highlighter_check_path() [[ ! -e ${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 ]]; then + if [[ ${BUFFER[1]} != "-" && ${#BUFFER} == $end_pos ]] && + [[ $WIDGET != accept-* ]]; then local -a tmp tmp=( ${expanded_path}*(N) ) (( $#tmp > 0 )) && style_override=path_prefix && return 0 diff --git a/highlighters/main/test-data/path_prefix2.zsh b/highlighters/main/test-data/path_prefix2.zsh index 13d8c9e..a1974eb 100644 --- a/highlighters/main/test-data/path_prefix2.zsh +++ b/highlighters/main/test-data/path_prefix2.zsh @@ -35,5 +35,5 @@ BUFFER='ls /bin/s' WIDGET=accept-line expected_region_highlight=( - "4 9 $ZSH_HIGHLIGHT_STYLES[default] 'implemented by next commit'" # /bin/s + "4 9 $ZSH_HIGHLIGHT_STYLES[default]" # /bin/s )