From f563780236eb989fd0d53552870ca479074f521b Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Sun, 29 Mar 2020 20:52:14 +0000 Subject: [PATCH] driver: Simplify initialization of $zsyh_user_options in the fallback codepath. --- zsh-syntax-highlighting.zsh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/zsh-syntax-highlighting.zsh b/zsh-syntax-highlighting.zsh index 73a92c6..a87a63c 100644 --- a/zsh-syntax-highlighting.zsh +++ b/zsh-syntax-highlighting.zsh @@ -93,9 +93,13 @@ _zsh_highlight() canonical_options=(${${${(M)raw_options:#*off}%% *}#no} ${${(M)raw_options:#*on}%% *}) for option in "${canonical_options[@]}"; do [[ -o $option ]] - # This variable cannot be eliminated c.f. workers/42101. - onoff=${${=:-off on}[2-$?]} - zsyh_user_options+=($option $onoff) + case $? in + (0) zsyh_user_options+=($option on);; + (1) zsyh_user_options+=($option off);; + (*) # Can't happen, surely? + echo "zsh-syntax-highlighting: warning: '[[ -o $option ]]' returned $?" + ;; + esac done fi typeset -r zsyh_user_options