Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions zsh-syntax-highlighting.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@ _zsh_highlight()
region_highlight[-1]=()
}

# Do not highlight if there are pending inputs (copy/paste).
# Placed before the region_highlight reset to preserve existing highlights.
(( KEYS_QUEUED_COUNT > 0 )) && return $ret
(( PENDING > 0 )) && return $ret

# Reset region_highlight to build it from scratch
if (( zsh_highlight__memo_feature )); then
region_highlight=( "${(@)region_highlight:#*memo=zsh-syntax-highlighting*}" )
Expand Down Expand Up @@ -210,10 +215,6 @@ _zsh_highlight()
# likely a pasted command or a huge list of files in that case..
[[ -n ${ZSH_HIGHLIGHT_MAXLENGTH:-} ]] && [[ $#BUFFER -gt $ZSH_HIGHLIGHT_MAXLENGTH ]] && return $ret

# Do not highlight if there are pending inputs (copy/paste).
(( KEYS_QUEUED_COUNT > 0 )) && return $ret
(( PENDING > 0 )) && return $ret

{
local cache_place
local -a region_highlight_copy
Expand Down