diff --git a/highlighters/main/main-highlighter.zsh b/highlighters/main/main-highlighter.zsh index 39b1145..b507b27 100644 --- a/highlighters/main/main-highlighter.zsh +++ b/highlighters/main/main-highlighter.zsh @@ -214,7 +214,7 @@ _zsh_highlight_highlighter_main_paint() integer multi_func_def=0 fi emulate -L zsh - setopt localoptions extendedglob bareglobqual + setopt localoptions extendedglob bareglobqual #xtrace # At the PS3 prompt and in vared, highlight nothing. # @@ -537,7 +537,9 @@ _zsh_highlight_highlighter_main_paint() style=alias _zsh_highlight_main__resolve_alias $arg local alias_target="$REPLY" - [[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_PRECOMMANDS:#"$alias_target"} && -z ${(M)ZSH_HIGHLIGHT_TOKENS_PRECOMMANDS:#"$arg"} ]] && ZSH_HIGHLIGHT_TOKENS_PRECOMMANDS+=($arg) + [[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_PRECOMMANDS:#"$alias_target"} + && -z ${(M)ZSH_HIGHLIGHT_TOKENS_PRECOMMANDS:#"$arg"} ]] && + ZSH_HIGHLIGHT_TOKENS_PRECOMMANDS+=($arg) || : fi } ;; @@ -684,7 +686,7 @@ _zsh_highlight_highlighter_main_paint() fi if ! (( already_added )); then _zsh_highlight_main_add_region_highlight $start_pos $end_pos $style - [[ $style == path || $style == path_prefix ]] && _zsh_highlight_main_highlighter_highlight_path_separators + [[ $style == path || $style == path_prefix ]] && _zsh_highlight_main_highlighter_highlight_path_separators || : fi if [[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_COMMANDSEPARATOR:#"$arg"} ]]; then if [[ $arg == ';' ]] && $in_array_assignment; then diff --git a/zsh-syntax-highlighting.zsh b/zsh-syntax-highlighting.zsh index 096b4c7..34b6147 100644 --- a/zsh-syntax-highlighting.zsh +++ b/zsh-syntax-highlighting.zsh @@ -66,7 +66,7 @@ _zsh_highlight() fi # Did a couple of tweaks to highlighters/main/main-highlighter.zsh -# to prevent need for following, though there'll surely be others. +# to prevent need for following, though there'll surely be other areas. # setopt localtraps # unfunction TRAPZERR setopt localoptions noksharrays warncreateglobal @@ -172,6 +172,9 @@ _zsh_highlight_apply_zle_highlight() { local entry="$1" default="$2" integer first="$3" second="$4" + setopt localoptions unset # seems to be the accessing the array entry +# rather than ${entry-} that aborts otherwise + # read the relevant entry from zle_highlight local region="${zle_highlight[(r)${entry}:*]}"