summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Core/_files31
-rw-r--r--Completion/User/_gdb2
-rw-r--r--Completion/User/_getconf1
-rw-r--r--Completion/User/_mh1
-rw-r--r--Completion/User/_netscape1
-rw-r--r--Completion/User/_tiff1
-rw-r--r--Completion/User/_urls7
-rw-r--r--Completion/X/_xmodmap1
8 files changed, 26 insertions, 19 deletions
diff --git a/Completion/Core/_files b/Completion/Core/_files
index 1755abebd..f16da0b50 100644
--- a/Completion/Core/_files
+++ b/Completion/Core/_files
@@ -1,12 +1,23 @@
 #autoload
 
-local opts tmp glob pats expl tag i pat descr minus
+local opts tmp glob pats expl tag i pat descr end ign ret=1
 
 zparseopts -a opts \
     '/=tmp' 'f=tmp' 'g+:-=tmp' q n 1 2 P: S: r: R: W: X+: M+: F: J+: V+:
 
 type="${(@j::M)${(@)tmp#-}#?}"
 (( $tmp[(I)-g*] )) && glob="${(j: :)${(M)tmp:#-g*}#-g}"
+ign=$opts[(I)-F]
+if (( ign )); then
+  ign=( $=opts[ign+1] )
+  if [[ $ign = _comp_ignore ]]; then
+    ign=( $_comp_ignore )
+  else
+    opts[tmp+1]=_comp_ignore
+  fi
+else
+  ign=
+fi
 
 if zstyle -a ":completion:${curcontext}:" file-patterns pats; then
   [[ "$type" = */* ]] && glob="$glob *(-/)"
@@ -34,16 +45,24 @@ for tag in "${(@)${(@)pats#*[^\\]:}%%:*}"; do
   if [[ i -gt 0 && "$pat" != \ # ]]; then
     if [[ "$pats[i]" = *:${tag}:* ]]; then
       descr="${pats[i]#*:${tag}:}"
-      minus=()
     else
       descr=file
-      minus=(-)
+      end=yes
     fi
   fi
 
-  _wanted "$tag" expl "$descr" \
-      _path_files -g "$pat" "$opts[@]" "$minus[@]" && return 0
-
+  if _wanted "$tag"; then
+    _comp_ignore=()
+    while _next_label "$tag" expl "$descr"; do
+      _comp_ignore=( $_comp_ignored $ign )
+      if [[ -n "$end" ]]; then
+        _path_files -g "$pat" "$opts[@]" "$expl[@]" && ret=0
+      else
+        _path_files "$expl[@]" -g "$pat" "$opts[@]" && ret=0
+      fi
+    done
+    (( ret )) || return 0
+  fi
 done
 
 return 1
diff --git a/Completion/User/_gdb b/Completion/User/_gdb
index 55e149bb7..a29eaf8b2 100644
--- a/Completion/User/_gdb
+++ b/Completion/User/_gdb
@@ -23,8 +23,8 @@ elif [[ "$PREFIX" = -* ]]; then
                                   -directory\= -cd\= -tty\= && ret=0
       compadd "$expl[@]"        - -help -h -s -e -c -x -d -nx -n -quiet -q \
 	    		          -batch -fullname -f -b && ret=0
-      (( ret )) || return 0
     done
+    (( ret )) || return 0
   fi
 else
   prev="$words[CURRENT-1]"
diff --git a/Completion/User/_getconf b/Completion/User/_getconf
index 59e9a83bc..613632c1d 100644
--- a/Completion/User/_getconf
+++ b/Completion/User/_getconf
@@ -29,7 +29,6 @@ if [[ CURRENT -eq 2 ]]; then
                                    _POSIX_NO_TRUNC _POSIX_VDISABLE && ret=0
           compadd "$expl[@]" -S ' ' LINK_MAX MAX_CANON MAX_INPUT NAME_MAX \
                                     PATH_MAX PIPE_BUF && ret=0
-          (( ret )) || break
         done
     (( ret )) || return 0
   done
diff --git a/Completion/User/_mh b/Completion/User/_mh
index c1f397744..724b45e5a 100644
--- a/Completion/User/_mh
+++ b/Completion/User/_mh
@@ -78,7 +78,6 @@ else
         ret=0
       compadd "$expl[@]" reply next cur prev first last all unseen && ret=0
       _files "$expl[@]" -W folddir -g '<->' && ret=0
-      (( ret )) || return 0
     done
   fi
   return ret
diff --git a/Completion/User/_netscape b/Completion/User/_netscape
index b29c27c6c..82fa4509a 100644
--- a/Completion/User/_netscape
+++ b/Completion/User/_netscape
@@ -82,7 +82,6 @@ if [[ "$state" = "urls" ]]; then
       while _next_label prefixes expl 'URL prefix'; do
         compadd "$expl[@]" -S '' about: mocha: javascript: && ret=0
         _urls "$@" && ret=0
-	(( ret )) || return 0
       done
     fi
   fi
diff --git a/Completion/User/_tiff b/Completion/User/_tiff
index 8fd008f0f..318c536d0 100644
--- a/Completion/User/_tiff
+++ b/Completion/User/_tiff
@@ -199,7 +199,6 @@ if [[ -n "$state" ]]; then
       while _next_label values expl 'compression scheme'; do
         compadd "$expl[@]" - none g4 packbits && ret=0
         compadd "$expl[@]" -qS: - lzw zip jpeg g3 && ret=0
-	(( ret )) || return 0
       done
     fi
   fi
diff --git a/Completion/User/_urls b/Completion/User/_urls
index 03e8902cb..3989f2219 100644
--- a/Completion/User/_urls
+++ b/Completion/User/_urls
@@ -59,7 +59,6 @@ if ! compset -P '(#b)([-+.a-z0-9]#):' && _wanted -C argument prefixes; then
     [[ -d $urls_path/bookmark ]] &&
       compadd "$expl[@]" -S '' bookmark: && ret=0
     compadd "$expl[@]" -S '' file: ftp:// gopher:// http:// && ret=0
-    (( ret )) || return 0
   done
   return ret
 fi
@@ -83,7 +82,6 @@ case "$scheme" in
         elif [[ -z "$PREFIX" ]]; then
 	  compadd "$expl[@]" -S '/' -r '/' - "${PWD%/}" && ret=0
         fi
-	(( ret )) || return 0
       done
       return ret
     fi
@@ -100,7 +98,6 @@ case "$scheme" in
           _path_files -W "$urls_path/$scheme" "$expl[@]" -S '' -g '*(^/)' && 
               ret=0
           _path_files -W "$urls_path/$scheme" -S/ -r '/' -/ && ret=0
-          (( ret )) || return 0
         done
       fi
     fi
@@ -116,7 +113,6 @@ if ! compset -P '(#b)([^/]#)/' && _wanted hosts; then
     (( $#uhosts )) || _hosts -S/ && ret=0
     [[ "$scheme" = http ]] && uhosts=($uhosts $localhttp_servername)
     compadd "$expl[@]" -S/ - $uhosts && ret=0
-    (( ret )) || return 0
   done
   return ret
 fi
@@ -136,20 +132,17 @@ if [[ "$localhttp_servername" = "$host" ]]; then
     while _next_label files expl 'local file'; do
       _path_files "$expl[@]" -W ~$user/$localhttp_userdir -g '*(^/)' && ret=0
       _path_files "$expl[@]" -W ~$user/$localhttp_userdir -S/ -r '/' -/ && ret=0
-      (( ret )) || return 0
     done
   else
     while _next_label files expl 'local file'; do
       _path_files "$expl[@]" -W $localhttp_documentroot -g '*(^/)' && ret=0
       _path_files "$expl[@]" -W $localhttp_documentroot -S/ -r '/' -/ && ret=0
-      (( ret )) || return 0
     done
   fi
 else
   while _next_label files expl 'local file'; do
     _path_files "$expl[@]" -W $urls_path/$scheme/$host -g '*(^/)' && ret=0
     _path_files "$expl[@]" -W $urls_path/$scheme/$host -S/ -r '/' -/ && ret=0
-    (( ret )) || return 0
   done
 fi
 return $ret
diff --git a/Completion/X/_xmodmap b/Completion/X/_xmodmap
index 1cd461d4c..6595d5adf 100644
--- a/Completion/X/_xmodmap
+++ b/Completion/X/_xmodmap
@@ -86,7 +86,6 @@ if [[ -n "$state" ]]; then
       while _next_label commands expl command; do
         compadd "$expl[@]" -S ' ' keycode keysym clear add remove && ret=0
         compadd "$expl[@]" -S ' = ' pointer && ret=0
-        (( ret )) || return 0
       done
     fi
   fi