Merge the first three commits of PR #669

* commit 'b1f36d9c5f45b879fbd2f64195167a60d9f3cb9e':
  'main': Add a comment.
  'main': Fix the $CDPATH from the previous commit.
  'main': Add a test for a $CDPATH bug.
This commit is contained in:
Daniel Shahaf
2020-03-16 19:32:59 +00:00
2 changed files with 45 additions and 4 deletions

View File

@@ -1103,10 +1103,13 @@ _zsh_highlight_main_highlighter_check_path()
[[ -e $expanded_path ]] && return 0
# Search the path in CDPATH
local cdpath_dir
for cdpath_dir in $cdpath ; do
[[ -e "$cdpath_dir/$expanded_path" ]] && return 0
done
if [[ $expanded_path != /* ]]; then
local cdpath_dir
# TODO: When we've dropped support for pre-5.0.6 zsh, use the *(Y1) glob qualifier here.
for cdpath_dir in $cdpath ; do
[[ -e "$cdpath_dir/$expanded_path" ]] && return 0
done
fi
# If dirname($1) doesn't exist, neither does $1.
[[ ! -d ${expanded_path:h} ]] && return 1