about summary refs log tree commit diff
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
parent38d2bf4af5a3c041ed838f10dbfc6d61c7458ece (diff)
downloadzsh-c109f9f9447920effdfc70f448704d5ab4b8d4c7.tar.gz
zsh-c109f9f9447920effdfc70f448704d5ab4b8d4c7.tar.xz
zsh-c109f9f9447920effdfc70f448704d5ab4b8d4c7.zip
25945: matching bug in path hierarchy completion
-rw-r--r--ChangeLog7
-rw-r--r--Completion/Unix/Type/_path_files23
2 files changed, 21 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 03ddd128c..9836db6b0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-10-29  Peter Stephenson  <p.w.stephenson@ntlworld.com>
+
+	* 25945: Completion/Unix/Type/_path_files: need some extra
+	matcher options to compadd for completing abbreviated
+	directory hierarchies when -U is not present (i.e. not
+	correcting).
+
 2008-10-29  Peter Stephenson  <pws@csr.com>
 
 	* Mikael: users/13412: Etc/relnote_4.3.7.txt: typo.
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