From 3a4b212c7d8263a12bef176b10737748b752a579 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Wed, 6 May 2020 20:25:03 +0000 Subject: [PATCH] 'main': Fix regression in zsh 5.3.1 and older: all precmd hooks later than z-sy-h would be aborted. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In those versions of zsh, «[[ -o nosuchoption ]]» is regarded as a syntax error. In newer zsh versions, it merely returns non-zero (specifically, it returns 3, unlike «[[ -o unsetoption ]]» which returns 1). Fixes #732. Fixes #733. --- changelog.md | 2 +- highlighters/main/main-highlighter.zsh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index 6c75259..120750c 100644 --- a/changelog.md +++ b/changelog.md @@ -77,7 +77,7 @@ - Fix an error message on stderr before every prompt when the `WARN_NESTED_VAR` zsh option is set: `_zsh_highlight_main__precmd_hook:1: array parameter _zsh_highlight_main__command_type_cache set in enclosing scope in function _zsh_highlight_main__precmd_hook` - [#727, #731] + [#727, #731, #732, #733] # Changes in version 0.7.1 diff --git a/highlighters/main/main-highlighter.zsh b/highlighters/main/main-highlighter.zsh index e4a17e0..59d4036 100644 --- a/highlighters/main/main-highlighter.zsh +++ b/highlighters/main/main-highlighter.zsh @@ -1692,7 +1692,7 @@ _zsh_highlight_main__precmd_hook() { # Unset the WARN_NESTED_VAR option, taking care not to error if the option # doesn't exist (zsh older than zsh-5.3.1-test-2). setopt localoptions - if [[ -o warnnestedvar ]] 2>/dev/null; then + if eval '[[ -o warnnestedvar ]]' 2>/dev/null; then unsetopt warnnestedvar fi