about summary refs log tree commit diff
path: root/Completion/Core/_path_files
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>2000-01-21 16:31:07 +0000
committerTanaka Akira <akr@users.sourceforge.net>2000-01-21 16:31:07 +0000
commit2697c3d52cda2cf4f88ab81cde2a37afc1796c7e (patch)
tree960cf063f8ed7205abe169f3cc8648d3a822f750 /Completion/Core/_path_files
parent7c109429799172a7bd606593ecf58b8d49b5790f (diff)
downloadzsh-2697c3d52cda2cf4f88ab81cde2a37afc1796c7e.tar.gz
zsh-2697c3d52cda2cf4f88ab81cde2a37afc1796c7e.tar.xz
zsh-2697c3d52cda2cf4f88ab81cde2a37afc1796c7e.zip
zsh-workers/9402
Diffstat (limited to 'Completion/Core/_path_files')
-rw-r--r--Completion/Core/_path_files27
1 files changed, 25 insertions, 2 deletions
diff --git a/Completion/Core/_path_files b/Completion/Core/_path_files
index 9c1be30bf..8c3b4ca63 100644
--- a/Completion/Core/_path_files
+++ b/Completion/Core/_path_files
@@ -5,7 +5,7 @@
 
 local linepath realpath donepath prepath testpath exppath
 local tmp1 tmp2 tmp3 tmp4 i orig eorig pre suf tpre tsuf opre osuf cpre
-local pats haspats=no ignore group expl addpfx addsfx remsfx
+local pats haspats=no ignore group expl addpfx addsfx remsfx rem remt
 local nm=$compstate[nmatches] menu mspec matcher mopts atmp sort match
 
 typeset -U prepaths exppaths
@@ -300,8 +300,31 @@ for prepath in "$prepaths[@]"; do
       tmp2=( ${^tmp1}${^~pats} )
       [[ ! -o globdots && "$PREFIX" = .* ]] &&
           tmp2=( "$tmp2[@]" ${^tmp1}.${^~pats} )
+      if (( $#tmp2 )) &&
+         zstyle -s ":completion${curcontext}:files" ignore-parents rem &&
+	 [[ ( "$rem" != *dir* || "$pats" = '*(-/)' ) &&
+	    ( "$rem" != *..* || "$tmp1" = *../* ) ]]; then
+        if [[ "$rem" = *parent* ]]; then
+	  for i in "$tmp2[@]"; do
+	    if [[ -d "$i" && "$i" = */* ]]; then
+	      remt="${i/*}"
+	      while [[ "$remt" = */* ]]; do
+		[[ "$remt" -ef "$i" ]] && break
+		remt="${remt%/*}"
+	      done
+	      [[ "$remt" = */* || "$remt" -ef "$i" ]] &&
+	          _comp_ignore=( "$_comp_ignore[@]" "${(q)i}" )
+	    fi
+	  done
+        fi
+        if [[ "$rem" = *pwd* ]]; then
+          for i in "$tmp2[@]"; do
+	    [[ "$i" -ef "$PWD" ]] && _comp_ignore=( "$_comp_ignore[@]" "${(q)i}" )
+	  done
+        fi
+      fi
       if [[ "$sopt" = *[/f]* && ( -o globdots || "$PREFIX" = .* ) ]] &&
-	 zstyle -s ":completion${curcontext}:paths" special-dirs atmp; then
+	  zstyle -s ":completion${curcontext}:paths" special-dirs atmp; then
 	if [[ "$atmp" = (yes|true|1|on) ]]; then
 	  tmp2=( "$tmp2[@]" . .. )
 	elif [[ "$atmp" = .. ]]; then