5eaebdf0fe870a8c599c89c6b70a0c5ee8c78b42

Author
Carlo Sala <carlosalag@protonmail.com>
Committer
Carlo Sala <carlosalag@protonmail.com>
Date

Message

fix(termsupport): ensure ohmyzsh can run with `set -eu`

Closes #12870

Diff

 1diff --git a/lib/async_prompt.zsh b/lib/async_prompt.zsh
 2index db48446e70351d34f535996c0c4e32afc69796d6..151e24b8c768c4cf52bb47bdafdb92e29584a49d 100644
 3--- a/lib/async_prompt.zsh
 4+++ b/lib/async_prompt.zsh
 5@@ -26,7 +26,7 @@ autoload -Uz is-at-least
 6 # This API is subject to change and optimization. Rely on it at your own risk.
 7 
 8 function _omz_register_handler {
 9-  setopt localoptions noksharrays
10+  setopt localoptions noksharrays unset
11   typeset -ga _omz_async_functions
12   # we want to do nothing if there's no $1 function or we already set it up
13   if [[ -z "$1" ]] || (( ! ${+functions[$1]} )) \
14@@ -44,6 +44,7 @@ function _omz_register_handler {
15 
16 # Set up async handlers and callbacks
17 function _omz_async_request {
18+  setopt localoptions noksharrays unset
19   local -i ret=$?
20   typeset -gA _OMZ_ASYNC_FDS _OMZ_ASYNC_PIDS _OMZ_ASYNC_OUTPUT
21 
22diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh
23index 087bae9bb809c0e92f00b1f20ebc5dae12ffbb59..d2fbf42cd67943df9ac25a93be1ad4693b89231d 100644
24--- a/lib/termsupport.zsh
25+++ b/lib/termsupport.zsh
26@@ -47,7 +47,7 @@ fi
27 
28 # Runs before showing the prompt
29 function omz_termsupport_precmd {
30-  [[ "${DISABLE_AUTO_TITLE:-}" != true ]] || return
31+  [[ "${DISABLE_AUTO_TITLE:-}" != true ]] || return 0
32   title "$ZSH_THEME_TERM_TAB_TITLE_IDLE" "$ZSH_THEME_TERM_TITLE_IDLE"
33 }
34 
35@@ -145,6 +145,7 @@ esac
36 # Identifies the directory using a file: URI scheme, including
37 # the host name to disambiguate local vs. remote paths.
38 function omz_termsupport_cwd {
39+  setopt localoptions unset
40   # Percent-encode the host and path names.
41   local URL_HOST URL_PATH
42   URL_HOST="$(omz_urlencode -P $HOST)" || return 1