From ece762e81798bc4448bf17f68a4792d1117dc032 Mon Sep 17 00:00:00 2001 From: jimmijj Date: Fri, 4 Sep 2015 00:41:02 +0200 Subject: [PATCH] User's definition of highlighting from "zle_highlight" array should take precedence over custom highlighters. This is especially important for *region context* (see CHARACTER HIGHLIGHTING chapter in `man zshzle` for *region context* definition), as this is overwritten by region_highlight array, leading to highlighting only parts of selected region properly. This commit forces to use type of highlighting as defined in region context of zle_highlight array. --- zsh-syntax-highlighting.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/zsh-syntax-highlighting.zsh b/zsh-syntax-highlighting.zsh index 7a86ac9..265b71f 100644 --- a/zsh-syntax-highlighting.zsh +++ b/zsh-syntax-highlighting.zsh @@ -90,6 +90,8 @@ _zsh_highlight() # Use value form cache if any cached eval "region_highlight+=(\"\${${cache_place}[@]}\")" + # 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 {