*: s/echo/print/

Just in case one of the interpolated variables contains a backslash.
This commit is contained in:
Daniel Shahaf 2016-07-21 04:01:50 +00:00
parent fffe13a8fb
commit 3409a2e4d2
2 changed files with 9 additions and 9 deletions

View file

@ -693,7 +693,7 @@ _zsh_highlight_main_highlighter_highlight_dollar_string()
# Does not perform filename generation (globbing).
_zsh_highlight_main_highlighter_expand_path()
{
(( $# == 1 )) || echo "zsh-syntax-highlighting: BUG: _zsh_highlight_main_highlighter_expand_path: called without argument" >&2
(( $# == 1 )) || print -r -- >&2 "zsh-syntax-highlighting: BUG: _zsh_highlight_main_highlighter_expand_path: called without argument"
# The $~1 syntax normally performs filename generation, but not when it's on the right-hand side of ${x:=y}.
setopt localoptions nonomatch
@ -714,7 +714,7 @@ if add-zsh-hook precmd _zsh_highlight_main__precmd_hook 2>/dev/null; then
# Initialize command type cache
typeset -gA _zsh_highlight_main__command_type_cache
else
echo 'zsh-syntax-highlighting: Failed to load add-zsh-hook. Some speed optimizations will not be used.' >&2
print -r -- >&2 'zsh-syntax-highlighting: Failed to load add-zsh-hook. Some speed optimizations will not be used.'
# Make sure the cache is unset
unset _zsh_highlight_main__command_type_cache
fi

View file

@ -245,7 +245,7 @@ _zsh_highlight_bind_widgets()
# Load ZSH module zsh/zleparameter, needed to override user defined widgets.
zmodload zsh/zleparameter 2>/dev/null || {
echo 'zsh-syntax-highlighting: failed loading zsh/zleparameter.' >&2
print -r -- >&2 'zsh-syntax-highlighting: failed loading zsh/zleparameter.'
return 1
}
@ -278,7 +278,7 @@ _zsh_highlight_bind_widgets()
zle -N $cur_widget _zsh_highlight_widget_$cur_widget;;
# Default: unhandled case.
*) echo "zsh-syntax-highlighting: unhandled ZLE widget '$cur_widget'" >&2 ;;
*) print -r -- >&2 "zsh-syntax-highlighting: unhandled ZLE widget '$cur_widget'" ;;
esac
done
}
@ -293,7 +293,7 @@ _zsh_highlight_load_highlighters()
# Check the directory exists.
[[ -d "$1" ]] || {
echo "zsh-syntax-highlighting: highlighters directory '$1' not found." >&2
print -r -- >&2 "zsh-syntax-highlighting: highlighters directory '$1' not found."
return 1
}
@ -305,7 +305,7 @@ _zsh_highlight_load_highlighters()
. "$highlighter_dir/${highlighter}-highlighter.zsh"
type "_zsh_highlight_${highlighter}_highlighter" &> /dev/null &&
type "_zsh_highlight_${highlighter}_highlighter_predicate" &> /dev/null || {
echo "zsh-syntax-highlighting: '${highlighter}' highlighter should define both required functions '_zsh_highlight_${highlighter}_highlighter' and '_zsh_highlight_${highlighter}_highlighter_predicate' in '${highlighter_dir}/${highlighter}-highlighter.zsh'." >&2
print -r -- >&2 "zsh-syntax-highlighting: '${highlighter}' highlighter should define both required functions '_zsh_highlight_${highlighter}_highlighter' and '_zsh_highlight_${highlighter}_highlighter_predicate' in '${highlighter_dir}/${highlighter}-highlighter.zsh'."
}
}
done
@ -318,13 +318,13 @@ _zsh_highlight_load_highlighters()
# Try binding widgets.
_zsh_highlight_bind_widgets || {
echo 'zsh-syntax-highlighting: failed binding ZLE widgets, exiting.' >&2
print -r -- >&2 'zsh-syntax-highlighting: failed binding ZLE widgets, exiting.'
return 1
}
# Resolve highlighters directory location.
_zsh_highlight_load_highlighters "${ZSH_HIGHLIGHT_HIGHLIGHTERS_DIR:-${${0:A}:h}/highlighters}" || {
echo 'zsh-syntax-highlighting: failed loading highlighters, exiting.' >&2
print -r -- >&@ 'zsh-syntax-highlighting: failed loading highlighters, exiting.'
return 1
}
@ -336,7 +336,7 @@ _zsh_highlight_preexec_hook()
}
autoload -U add-zsh-hook
add-zsh-hook preexec _zsh_highlight_preexec_hook 2>/dev/null || {
echo 'zsh-syntax-highlighting: failed loading add-zsh-hook.' >&2
print -r -- >&2 'zsh-syntax-highlighting: failed loading add-zsh-hook.'
}
# Load zsh/parameter module if available