From a2a899b41b8b467b6c46b3f56c829a58657e671e Mon Sep 17 00:00:00 2001
From: Daniel Shahaf <danielsh@apache.org>
Date: Thu, 2 Nov 2017 17:07:10 +0000
Subject: [PATCH] driver: _zsh_highlight_bind_widgets: Be resilient to NO_UNSET
 being set in the calling scope.

Fixes #449.
---
 zsh-syntax-highlighting.zsh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/zsh-syntax-highlighting.zsh b/zsh-syntax-highlighting.zsh
index e36c3c3..47288c5 100644
--- a/zsh-syntax-highlighting.zsh
+++ b/zsh-syntax-highlighting.zsh
@@ -295,7 +295,7 @@ _zsh_highlight_bind_widgets()
 
   local cur_widget
   for cur_widget in $widgets_to_bind; do
-    case $widgets[$cur_widget] in
+    case ${widgets[$cur_widget]:-""} in
 
       # Already rebound event: do nothing.
       user:_zsh_highlight_widget_*);;
@@ -322,7 +322,7 @@ _zsh_highlight_bind_widgets()
 
       # Incomplete or nonexistent widget: Bind to z-sy-h directly.
       *) 
-         if [[ $cur_widget == zle-* ]] && [[ -z $widgets[$cur_widget] ]]; then
+         if [[ $cur_widget == zle-* ]] && (( ! ${+widgets[$cur_widget]} )); then
            _zsh_highlight_widget_${cur_widget}() { :; _zsh_highlight }
            zle -N $cur_widget _zsh_highlight_widget_$cur_widget
          else