Make core syntax highlighting a function.
Make `_zsh_highlight-zle-buffer` just a hands-off. Now, `_zsh_highlight-zle-buffer` calls each ZSH_HIGHLIGHT_FUNCTIONS in turn. The former `_zsh_highlight-zle-buffer` is renamed to `_zsh_main-highlight.` Signed-off-by: Takeshi Banse <takebi@laafc.net>
This commit is contained in:
parent
ea792cbf87
commit
07588d2165
@ -106,8 +106,22 @@ _zsh_highlight-string() {
|
||||
done
|
||||
}
|
||||
|
||||
# Functions to be called in _zsh_highlight-zle-buffer.
|
||||
ZSH_HIGHLIGHT_FUNCTIONS=(
|
||||
_zsh_main-highlight
|
||||
)
|
||||
|
||||
# Recolorize the current ZLE buffer.
|
||||
_zsh_highlight-zle-buffer() {
|
||||
local ret=$?
|
||||
{
|
||||
for func in ${ZSH_HIGHLIGHT_FUNCTIONS}; do "$func"; done
|
||||
} always {
|
||||
return $ret
|
||||
}
|
||||
}
|
||||
|
||||
_zsh_main-highlight() {
|
||||
# Avoid doing the same work over and over
|
||||
[[ ${ZSH_PRIOR_HIGHLIGHTED_BUFFER:-} == $BUFFER ]] && [[ ${#region_highlight} -gt 0 ]] && (( ZSH_PRIOR_CURSOR == CURSOR )) && return
|
||||
ZSH_PRIOR_HIGHLIGHTED_BUFFER=$BUFFER
|
||||
|
Loading…
Reference in New Issue
Block a user