From abec25d013fecbc29202d0b3d93bcb3155a3a557 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Sat, 16 Mar 2019 07:47:53 +0000 Subject: [PATCH] 'main': _zsh_highlight_main__type: Add comments. --- highlighters/main/main-highlighter.zsh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/highlighters/main/main-highlighter.zsh b/highlighters/main/main-highlighter.zsh index 71bec9d..02be55c 100644 --- a/highlighters/main/main-highlighter.zsh +++ b/highlighters/main/main-highlighter.zsh @@ -173,6 +173,10 @@ _zsh_highlight_main__type() { REPLY=builtin elif (( $+commands[(e)$1] )); then REPLY=command + # None of the special hashes had a match, so fall back to 'type -w', for + # forward compatibility with future versions of zsh that may add new command + # types. + # # zsh 5.2 and older have a bug whereby running 'type -w ./sudo' implicitly # runs 'hash ./sudo=/usr/local/bin/./sudo' (assuming /usr/local/bin/sudo # exists and is in $PATH). Avoid triggering the bug, at the expense of @@ -187,6 +191,8 @@ _zsh_highlight_main__type() { fi fi if ! (( $+REPLY )); then + # zsh/parameter not available or had no matches. + # # Note that 'type -w' will run 'rehash' implicitly. # # We 'unalias' in a subshell, so the parent shell is not affected.