From ff85c7e01b0a7e5d9f92fc0195685edbea2b8dbc Mon Sep 17 00:00:00 2001 From: Matthew Martin Date: Tue, 6 Feb 2018 18:48:46 -0600 Subject: [PATCH] driver: Do not highlight newlines or past BUFFER for zle standout --- zsh-syntax-highlighting.zsh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/zsh-syntax-highlighting.zsh b/zsh-syntax-highlighting.zsh index f933f70..eee0284 100644 --- a/zsh-syntax-highlighting.zsh +++ b/zsh-syntax-highlighting.zsh @@ -168,8 +168,10 @@ _zsh_highlight() else min=$MARK max=$CURSOR fi - (( min = ${${BUFFER[1,$min]}[(I)$needle]} )) - (( max += ${${BUFFER:($max-1)}[(i)$needle]} - 1 )) + # CURSOR and MARK are 0 indexed between letters like region_highlight + # Do not include the newline in the highlight + (( min = ${BUFFER[(Ib:min:)$needle]} )) + (( max = ${BUFFER[(ib:max:)$needle]} - 1 )) _zsh_highlight_apply_zle_highlight region standout "$min" "$max" } fi