about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Completion/Unix/Type/_path_files30
2 files changed, 21 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index 8757583f5..286abeaf8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-10-22  Barton E. Schaefer  <schaefer@zsh.org>
+
+	* 25927: Completion/Unix/Type/_path_files: include the ignored
+	prefix/suffix in the hidden prefix/suffix only for compadd -U.
+
 2008-10-23  Clint Adams  <clint@zsh.org>
 
 	* 25926: Src/params.c: free val only after it may be passed to
diff --git a/Completion/Unix/Type/_path_files b/Completion/Unix/Type/_path_files
index 018a1ded8..28df7e1ba 100644
--- a/Completion/Unix/Type/_path_files
+++ b/Completion/Unix/Type/_path_files
@@ -612,8 +612,9 @@ for prepath in "$prepaths[@]"; do
 	    # back up the path.
 	    tmp1=("${(@)tmp1%%/*}")
 	    _list_files tmp1 "$prepath$realpath$testpath"
-	    compadd $Uopt -Qf "$mopts[@]" -p "$IPREFIX$linepath$tmp2" \
-	            -s "/${tmp3#*/}$ISUFFIX" \
+	    compadd $Uopt -Qf "$mopts[@]" \
+                    -p "${Uopt:+$IPREFIX}$linepath$tmp2" \
+	            -s "/${tmp3#*/}${Uopt:+$ISUFFIX}" \
 	            -W "$prepath$realpath$testpath" \
 		    "$pfxsfx[@]" \
 		    $listopts \
@@ -622,8 +623,9 @@ for prepath in "$prepaths[@]"; do
 	    # Same with a non-empty suffix
 	    tmp1=("${(@)^tmp1%%/*}/${tmp3#*/}")
 	    _list_files tmp1 "$prepath$realpath$testpath"
-	    compadd $Uopt -Qf "$mopts[@]" -p "$IPREFIX$linepath$tmp2" \
-	            -s "$ISUFFIX" \
+	    compadd $Uopt -Qf "$mopts[@]" \
+                    -p "${Uopt:+$IPREFIX}$linepath$tmp2" \
+	            -s "${Uopt:+$ISUFFIX}" \
 	            -W "$prepath$realpath$testpath" \
 		    "$pfxsfx[@]" \
 	            $listopts \
@@ -631,8 +633,8 @@ for prepath in "$prepaths[@]"; do
           fi
 	else
 	  _list_files tmp1 "$prepath$realpath$testpath"
-	  compadd $Uopt -Qf "$mopts[@]" -p "$IPREFIX$linepath$tmp2" \
-	          -s "$ISUFFIX" \
+	  compadd $Uopt -Qf "$mopts[@]" -p "${Uopt:+$IPREFIX}$linepath$tmp2" \
+	          -s "${Uopt:+$ISUFFIX}" \
 	          -W "$prepath$realpath$testpath" \
 		   "$pfxsfx[@]" \
 	           $listopts \
@@ -641,8 +643,8 @@ for prepath in "$prepaths[@]"; do
       else
 	# We are inserting the match into the command line.
         if [[ "$tmp3" = */* ]]; then
-	  tmp4=( -U -Qf "$mopts[@]" -p "$IPREFIX$linepath$tmp2"
-	         -s "$ISUFFIX"
+	  tmp4=( $Uopt -Qf "$mopts[@]" -p "${Uopt:+$IPREFIX}$linepath$tmp2"
+	         -s "${Uopt:+$ISUFFIX}"
 	         -W "$prepath$realpath$testpath"
 	         "$pfxsfx[@]" )
 	  if [[ -z "$listsfx" ]]; then
@@ -661,8 +663,8 @@ for prepath in "$prepaths[@]"; do
           fi
         else
 	  _list_files tmp1 "$prepath$realpath$testpath"
-	  compadd $Uopt -Qf "$mopts[@]" -p "$IPREFIX$linepath$tmp2" \
-	          -s "$ISUFFIX" \
+	  compadd $Uopt -Qf "$mopts[@]" -p "${Uopt:+$IPREFIX}$linepath$tmp2" \
+	          -s "${Uopt:+$ISUFFIX}" \
                   -W "$prepath$realpath$testpath" \
 		  "$pfxsfx[@]" \
                   $listopts \
@@ -730,8 +732,8 @@ for prepath in "$prepaths[@]"; do
       compquote tmp4 tmp2 tmp1
       for i in "$tmp1[@]"; do
 	_list_files tmp2 "$prepath$realpath${mid%/*/}"
-        compadd $Uopt -Qf "$mopts[@]" -p "$IPREFIX$linepath$tmp3/" \
-	        -s "/$tmp4$i$ISUFFIX" \
+        compadd $Uopt -Qf "$mopts[@]" -p "${Uopt:+IPREFIX}$linepath$tmp3/" \
+	        -s "/$tmp4$i${Uopt:+$ISUFFIX}" \
                 -W "$prepath$realpath${mid%/*/}/" \
 	        "$pfxsfx[@]" $listopts - "$tmp2"
       done
@@ -761,8 +763,8 @@ for prepath in "$prepaths[@]"; do
       else
 	# Not a pattern match
 	_list_files tmp1 "$prepath$realpath$testpath"
-        compadd $Uopt -Qf -p "$IPREFIX$linepath$tmp4" \
-	        -s "$ISUFFIX" \
+        compadd $Uopt -Qf -p "${Uopt:+IPREFIX}$linepath$tmp4" \
+	        -s "${Uopt:+$ISUFFIX}" \
 	        -W "$prepath$realpath$testpath" \
 	        "$pfxsfx[@]" "$mopts[@]" $listopts -a tmp1
       fi