File tree 1 file changed +15
-1
lines changed
1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -756,14 +756,27 @@ _zsh_highlight_main_highlighter_highlight_path_separators()
756
756
_zsh_highlight_main_highlighter_check_path ()
757
757
{
758
758
_zsh_highlight_main_highlighter_expand_path $arg ;
759
- local expanded_path=" $REPLY "
759
+ local expanded_path=" $REPLY " tmp_path
760
760
761
761
REPLY=path
762
762
763
763
[[ -z $expanded_path ]] && return 1
764
764
[[ -L $expanded_path ]] && return 0
765
765
[[ -e $expanded_path ]] && return 0
766
766
767
+ # Check if this is a disallowed path
768
+ if [[ $expanded_path [1] == / ]]; then
769
+ tmp_path=$expanded_path
770
+ else
771
+ tmp_path=$PWD /$expanded_path
772
+ fi
773
+ tmp_path=$tmp_path :a
774
+
775
+ while [[ $tmp_path != / ]]; do
776
+ [[ -z " ${tmp_path: |ZSH_HIGHLIGHT_DIRS_BLACKLIST} " ]] && return 1
777
+ tmp_path=$tmp_path :h
778
+ done
779
+
767
780
# Search the path in CDPATH
768
781
local cdpath_dir
769
782
for cdpath_dir in $cdpath ; do
@@ -1063,3 +1076,4 @@ else
1063
1076
# Make sure the cache is unset
1064
1077
unset _zsh_highlight_main__command_type_cache
1065
1078
fi
1079
+ typeset -g a ZSH_HIGHLIGHT_DIRS_BLACKLIST
You can’t perform that action at this time.
0 commit comments