mirror of
https://github.com/zsh-users/zsh-syntax-highlighting.git
synced 2025-04-17 11:35:32 +08:00
1. Removed two additional widgets from the rebinding list: push-input and push-line-or-edit. Both didn't call "_zsh_highlight" function anyhow due to operation principle of these widgets.
2. Adjusted place where zle_highlight is added to region_highlight in order to do it only once (not for all highlithers). 3. Changed indentation in zsh-syntax-highlighting.zsh to make code a bit cleaner and easier to read.
This commit is contained in:
parent
ece762e817
commit
3a6ba003d1
@ -62,7 +62,8 @@ _zsh_highlight()
|
||||
local -a region_highlight_copy
|
||||
|
||||
# Select which highlighters in ZSH_HIGHLIGHT_HIGHLIGHTERS need to be invoked.
|
||||
local highlighter; for highlighter in $ZSH_HIGHLIGHT_HIGHLIGHTERS; do
|
||||
local highlighter
|
||||
for highlighter in $ZSH_HIGHLIGHT_HIGHLIGHTERS; do
|
||||
|
||||
# eval cache place for current highlighter and prepare it
|
||||
cache_place="_zsh_highlight_${highlighter}_highlighter_cache"
|
||||
@ -90,9 +91,10 @@ _zsh_highlight()
|
||||
# Use value form cache if any cached
|
||||
eval "region_highlight+=(\"\${${cache_place}[@]}\")"
|
||||
|
||||
done
|
||||
|
||||
# Bring back region higlighting from zle_highlight array (was overwriten by region_highlight)
|
||||
((REGION_ACTIVE)) && region_highlight+=("$((CURSOR < MARK ? CURSOR : MARK)) $((CURSOR > MARK ? CURSOR : MARK)) ${${(M)zle_highlight[@]:#region*}#region:}")
|
||||
done
|
||||
|
||||
} always {
|
||||
_ZSH_HIGHLIGHT_PRIOR_BUFFER=$BUFFER
|
||||
@ -142,7 +144,7 @@ _zsh_highlight_bind_widgets()
|
||||
|
||||
# Override ZLE widgets to make them invoke _zsh_highlight.
|
||||
local cur_widget
|
||||
for cur_widget in ${${(f)"$(builtin zle -la)"}:#(.*|_*|orig-*|run-help|beep|auto-*|*-argument|argument-base|clear-screen|describe-key-briefly|kill-buffer|overwrite-mode|reset-prompt|set-local-history|split-undo|undefined-key|what-cursor-position|where-is)}; do
|
||||
for cur_widget in ${${(f)"$(builtin zle -la)"}:#(.*|_*|orig-*|run-help|beep|auto-*|*-argument|argument-base|clear-screen|describe-key-briefly|kill-buffer|overwrite-mode|push-input|push-line-or-edit|reset-prompt|set-local-history|split-undo|undefined-key|what-cursor-position|where-is)}; do
|
||||
case $widgets[$cur_widget] in
|
||||
|
||||
# Already rebound event: do nothing.
|
||||
|
Loading…
Reference in New Issue
Block a user