Skip to content

Commit 3409a2e

Browse files
committed
*: s/echo/print/
Just in case one of the interpolated variables contains a backslash.
1 parent fffe13a commit 3409a2e

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

highlighters/main/main-highlighter.zsh

+2-2
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ _zsh_highlight_main_highlighter_highlight_dollar_string()
693693
# Does not perform filename generation (globbing).
694694
_zsh_highlight_main_highlighter_expand_path()
695695
{
696-
(( $# == 1 )) || echo "zsh-syntax-highlighting: BUG: _zsh_highlight_main_highlighter_expand_path: called without argument" >&2
696+
(( $# == 1 )) || print -r -- >&2 "zsh-syntax-highlighting: BUG: _zsh_highlight_main_highlighter_expand_path: called without argument"
697697

698698
# The $~1 syntax normally performs filename generation, but not when it's on the right-hand side of ${x:=y}.
699699
setopt localoptions nonomatch
@@ -714,7 +714,7 @@ if add-zsh-hook precmd _zsh_highlight_main__precmd_hook 2>/dev/null; then
714714
# Initialize command type cache
715715
typeset -gA _zsh_highlight_main__command_type_cache
716716
else
717-
echo 'zsh-syntax-highlighting: Failed to load add-zsh-hook. Some speed optimizations will not be used.' >&2
717+
print -r -- >&2 'zsh-syntax-highlighting: Failed to load add-zsh-hook. Some speed optimizations will not be used.'
718718
# Make sure the cache is unset
719719
unset _zsh_highlight_main__command_type_cache
720720
fi

zsh-syntax-highlighting.zsh

+7-7
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ _zsh_highlight_bind_widgets()
245245

246246
# Load ZSH module zsh/zleparameter, needed to override user defined widgets.
247247
zmodload zsh/zleparameter 2>/dev/null || {
248-
echo 'zsh-syntax-highlighting: failed loading zsh/zleparameter.' >&2
248+
print -r -- >&2 'zsh-syntax-highlighting: failed loading zsh/zleparameter.'
249249
return 1
250250
}
251251

@@ -278,7 +278,7 @@ _zsh_highlight_bind_widgets()
278278
zle -N $cur_widget _zsh_highlight_widget_$cur_widget;;
279279

280280
# Default: unhandled case.
281-
*) echo "zsh-syntax-highlighting: unhandled ZLE widget '$cur_widget'" >&2 ;;
281+
*) print -r -- >&2 "zsh-syntax-highlighting: unhandled ZLE widget '$cur_widget'" ;;
282282
esac
283283
done
284284
}
@@ -293,7 +293,7 @@ _zsh_highlight_load_highlighters()
293293

294294
# Check the directory exists.
295295
[[ -d "$1" ]] || {
296-
echo "zsh-syntax-highlighting: highlighters directory '$1' not found." >&2
296+
print -r -- >&2 "zsh-syntax-highlighting: highlighters directory '$1' not found."
297297
return 1
298298
}
299299

@@ -305,7 +305,7 @@ _zsh_highlight_load_highlighters()
305305
. "$highlighter_dir/${highlighter}-highlighter.zsh"
306306
type "_zsh_highlight_${highlighter}_highlighter" &> /dev/null &&
307307
type "_zsh_highlight_${highlighter}_highlighter_predicate" &> /dev/null || {
308-
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
308+
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'."
309309
}
310310
}
311311
done
@@ -318,13 +318,13 @@ _zsh_highlight_load_highlighters()
318318

319319
# Try binding widgets.
320320
_zsh_highlight_bind_widgets || {
321-
echo 'zsh-syntax-highlighting: failed binding ZLE widgets, exiting.' >&2
321+
print -r -- >&2 'zsh-syntax-highlighting: failed binding ZLE widgets, exiting.'
322322
return 1
323323
}
324324

325325
# Resolve highlighters directory location.
326326
_zsh_highlight_load_highlighters "${ZSH_HIGHLIGHT_HIGHLIGHTERS_DIR:-${${0:A}:h}/highlighters}" || {
327-
echo 'zsh-syntax-highlighting: failed loading highlighters, exiting.' >&2
327+
print -r -- >&@ 'zsh-syntax-highlighting: failed loading highlighters, exiting.'
328328
return 1
329329
}
330330

@@ -336,7 +336,7 @@ _zsh_highlight_preexec_hook()
336336
}
337337
autoload -U add-zsh-hook
338338
add-zsh-hook preexec _zsh_highlight_preexec_hook 2>/dev/null || {
339-
echo 'zsh-syntax-highlighting: failed loading add-zsh-hook.' >&2
339+
print -r -- >&2 'zsh-syntax-highlighting: failed loading add-zsh-hook.'
340340
}
341341

342342
# Load zsh/parameter module if available

0 commit comments

Comments
 (0)