From 0e31d6e1a298adfce9596b7048f207c9940d495d Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Tue, 8 Sep 2015 20:22:22 +0000 Subject: [PATCH] Highlight the region on top of syntax highlighting. Let $zle_highlight[region] override $region_highlight. --- zsh-syntax-highlighting.zsh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/zsh-syntax-highlighting.zsh b/zsh-syntax-highlighting.zsh index ef62139..e105a9f 100644 --- a/zsh-syntax-highlighting.zsh +++ b/zsh-syntax-highlighting.zsh @@ -92,6 +92,22 @@ _zsh_highlight() done + # Re-apply zle_highlight settings + () { + if (( REGION_ACTIVE )) ; then + # zle_highlight[region] defaults to 'standout' if unspecified + local region="${${zle_highlight[(r)region:*]#region:}:-standout}" + integer start end + if (( MARK > CURSOR )) ; then + start=$CURSOR end=$MARK + else + start=$MARK end=$CURSOR + fi + region_highlight+=("$start $end $region") + fi + } + + } always { _ZSH_HIGHLIGHT_PRIOR_BUFFER=$BUFFER _ZSH_HIGHLIGHT_PRIOR_CURSOR=$CURSOR