summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2008-10-29 21:59:32 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2008-10-29 21:59:32 +0000
commitc109f9f9447920effdfc70f448704d5ab4b8d4c7 (patch)
tree00abbcfd4f9fc6deee5e4c76cc54042937a5a56a /Completion
parent38d2bf4af5a3c041ed838f10dbfc6d61c7458ece (diff)
downloadzsh-c109f9f9447920effdfc70f448704d5ab4b8d4c7.tar.gz
zsh-c109f9f9447920effdfc70f448704d5ab4b8d4c7.tar.xz
zsh-c109f9f9447920effdfc70f448704d5ab4b8d4c7.zip
25945: matching bug in path hierarchy completion
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Unix/Type/_path_files23
1 files changed, 14 insertions, 9 deletions
diff --git a/Completion/Unix/Type/_path_files b/Completion/Unix/Type/_path_files
index 378c45441..572cd0335 100644
--- a/Completion/Unix/Type/_path_files
+++ b/Completion/Unix/Type/_path_files
@@ -9,7 +9,7 @@ local pats haspats ignore pfx pfxsfx sopt gopt opt sdirs ignpar cfopt listsfx
 local nm=$compstate[nmatches] menu matcher mopts sort mid accex fake
 local listfiles listopts tmpdisp origtmp1 Uopt
 integer npathcheck
-local -a match mbegin mend
+local -a match mbegin mend Mopts
 
 typeset -U prepaths exppaths
 
@@ -209,7 +209,12 @@ eorig="$orig"
 [[ $compstate[insert] = (*menu|[0-9]*) || -n "$_comp_correct" ||
    ( -n "$compstate[pattern_match]" &&
      "${orig#\~}" != (|*[^\\])[][*?#~^\|\<\>]* ) ]] && menu=yes
-[[ -n "$_comp_correct" ]] && cfopt=- Uopt=-U
+if [[ -n "$_comp_correct" ]]; then
+    cfopt=-
+    Uopt=-U
+else
+    Mopts=(-M "r:|/=* r:|=*")
+fi
 
 # Now let's have a closer look at the string to complete.
 
@@ -616,7 +621,7 @@ for prepath in "$prepaths[@]"; do
                     -p "${Uopt:+$IPREFIX}$linepath$tmp2" \
 	            -s "/${tmp3#*/}${Uopt:+$ISUFFIX}" \
 	            -W "$prepath$realpath$testpath" \
-		    "$pfxsfx[@]" \
+		    "$pfxsfx[@]" $Mopts \
 		    $listopts \
 	            -a tmp1
           else
@@ -627,7 +632,7 @@ for prepath in "$prepaths[@]"; do
                     -p "${Uopt:+$IPREFIX}$linepath$tmp2" \
 	            -s "${Uopt:+$ISUFFIX}" \
 	            -W "$prepath$realpath$testpath" \
-		    "$pfxsfx[@]" \
+		    "$pfxsfx[@]" $Mopts \
 	            $listopts \
 		    -a tmp1
           fi
@@ -636,7 +641,7 @@ for prepath in "$prepaths[@]"; do
 	  compadd $Uopt -Qf "$mopts[@]" -p "${Uopt:+$IPREFIX}$linepath$tmp2" \
 	          -s "${Uopt:+$ISUFFIX}" \
 	          -W "$prepath$realpath$testpath" \
-		   "$pfxsfx[@]" \
+		   "$pfxsfx[@]" $Mopts \
 	           $listopts \
 		   -a tmp1
 	fi
@@ -646,7 +651,7 @@ for prepath in "$prepaths[@]"; do
 	  tmp4=( $Uopt -Qf "$mopts[@]" -p "${Uopt:+$IPREFIX}$linepath$tmp2"
 	         -s "${Uopt:+$ISUFFIX}"
 	         -W "$prepath$realpath$testpath"
-	         "$pfxsfx[@]" )
+	         "$pfxsfx[@]" $Mopts )
 	  if [[ -z "$listsfx" ]]; then
             for i in "$tmp1[@]"; do
 	      tmpdisp=("${i%%/*}")
@@ -666,7 +671,7 @@ for prepath in "$prepaths[@]"; do
 	  compadd $Uopt -Qf "$mopts[@]" -p "${Uopt:+$IPREFIX}$linepath$tmp2" \
 	          -s "${Uopt:+$ISUFFIX}" \
                   -W "$prepath$realpath$testpath" \
-		  "$pfxsfx[@]" \
+		  "$pfxsfx[@]" $Mopts \
                   $listopts \
 		  -a tmp1
         fi
@@ -735,7 +740,7 @@ for prepath in "$prepaths[@]"; do
         compadd $Uopt -Qf "$mopts[@]" -p "${Uopt:+$IPREFIX}$linepath$tmp3/" \
 	        -s "/$tmp4$i${Uopt:+$ISUFFIX}" \
                 -W "$prepath$realpath${mid%/*/}/" \
-	        "$pfxsfx[@]" $listopts - "$tmp2"
+	        "$pfxsfx[@]" $Mopts $listopts - "$tmp2"
       done
     else
       if [[ "$osuf" = */* ]]; then
@@ -766,7 +771,7 @@ for prepath in "$prepaths[@]"; do
         compadd $Uopt -Qf -p "${Uopt:+$IPREFIX}$linepath$tmp4" \
 	        -s "${Uopt:+$ISUFFIX}" \
 	        -W "$prepath$realpath$testpath" \
-	        "$pfxsfx[@]" "$mopts[@]" $listopts -a tmp1
+	        "$pfxsfx[@]" "$mopts[@]" $Mopts $listopts -a tmp1
       fi
     fi
   fi