main: Refresh highlighting upon accept-* widgets (accept-line et al).
Use this to remove [path_prefix] highlighting during accept-* widgets. This causes ": file.tx<CR>" to remove the underline from "file.tx", like ": file.tx<SPACE>" already does. (Assume 'file.txt' exists.)
This commit is contained in:
parent
7723edf4f5
commit
59fbdda64c
@ -59,7 +59,9 @@
|
|||||||
# Whether the highlighter should be called or not.
|
# Whether the highlighter should be called or not.
|
||||||
_zsh_highlight_main_highlighter_predicate()
|
_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.
|
# Helper to deal with tokens crossing line boundaries.
|
||||||
@ -280,7 +282,8 @@ _zsh_highlight_main_highlighter_check_path()
|
|||||||
[[ ! -e ${expanded_path:h} ]] && return 1
|
[[ ! -e ${expanded_path:h} ]] && return 1
|
||||||
|
|
||||||
# If this word ends the buffer, check if it's the prefix of a valid path.
|
# 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
|
local -a tmp
|
||||||
tmp=( ${expanded_path}*(N) )
|
tmp=( ${expanded_path}*(N) )
|
||||||
(( $#tmp > 0 )) && style_override=path_prefix && return 0
|
(( $#tmp > 0 )) && style_override=path_prefix && return 0
|
||||||
|
@ -35,5 +35,5 @@ BUFFER='ls /bin/s'
|
|||||||
WIDGET=accept-line
|
WIDGET=accept-line
|
||||||
|
|
||||||
expected_region_highlight=(
|
expected_region_highlight=(
|
||||||
"4 9 $ZSH_HIGHLIGHT_STYLES[default] 'implemented by next commit'" # /bin/s
|
"4 9 $ZSH_HIGHLIGHT_STYLES[default]" # /bin/s
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user