'main': Fix regression in zsh 5.3.1 and older: all precmd hooks later than z-sy-h would be aborted.

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.
This commit is contained in:
Daniel Shahaf
2020-05-06 20:25:03 +00:00
parent 0582ea1910
commit 3a4b212c7d
2 changed files with 2 additions and 2 deletions

View File

@@ -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