From b00be5f741e2b4f01abd0258a4b1ed662a4d158d Mon Sep 17 00:00:00 2001 From: Austin Traver Date: Fri, 13 Mar 2020 01:16:40 -0700 Subject: [PATCH] driver: Be resilient to KSH_ARRAYS being set in the calling scope MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The «emulate» call isn't sufficient, since these lines are parsed before it takes effect. Fixes #689 (née #622). See also #688 for preventing these gymnastics from being needed in the first place. See also https://github.com/junegunn/fzf/pull/1924 for an inter-plugin interaction that this probably fixes. --- 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 fd2a7c6..ff75108 100644 --- a/zsh-syntax-highlighting.zsh +++ b/zsh-syntax-highlighting.zsh @@ -86,12 +86,12 @@ _zsh_highlight() # Before we 'emulate -L', save the user's options local -A zsyh_user_options if zmodload -e zsh/parameter; then - zsyh_user_options=("${(@kv)options}") + zsyh_user_options=("${(kv)options[@]}") else local canonical_options onoff option raw_options raw_options=(${(f)"$(emulate -R zsh; set -o)"}) canonical_options=(${${${(M)raw_options:#*off}%% *}#no} ${${(M)raw_options:#*on}%% *}) - for option in $canonical_options; do + for option in "${canonical_options[@]}"; do [[ -o $option ]] # This variable cannot be eliminated c.f. workers/42101. onoff=${${=:-off on}[2-$?]}