Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: zsh 4.3.8 regression: buggy completion



On Wed, 29 Oct 2008 20:10:14 +0100
Vincent Lefevre <vincent@xxxxxxxxxx> wrote:
> With zsh 4.3.8, I can no longer complete using the the first
> characters of each directory, e.g. "cd /u/lo/li[TAB]" for
> /usr/local/lib. AFAIK, the pre-release didn't have this problem.

Thanks for noticing.

I can get this with zsh -f plus compinit, but for some reason not with
my usual options.  (Hence my comment about the pinball rolling down
_path_files different ways.)  Comparing with previous versions shows
there's a matcher option missing from compadd when -U is not also
present.  (We shouldn't have had to remove the matcher when -U is
present, it just prevented me having to fix the internal completion
code.)

Please confirm this fixes it and I'll make 4.3.9.

Index: Completion/Unix/Type/_path_files
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Type/_path_files,v
retrieving revision 1.38
diff -u -r1.38 _path_files
--- Completion/Unix/Type/_path_files	28 Oct 2008 22:23:05 -0000	1.38
+++ Completion/Unix/Type/_path_files	29 Oct 2008 21:51:33 -0000
@@ -9,7 +9,7 @@
 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 @@
 [[ $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 @@
                     -p "${Uopt:+$IPREFIX}$linepath$tmp2" \
 	            -s "/${tmp3#*/}${Uopt:+$ISUFFIX}" \
 	            -W "$prepath$realpath$testpath" \
-		    "$pfxsfx[@]" \
+		    "$pfxsfx[@]" $Mopts \
 		    $listopts \
 	            -a tmp1
           else
@@ -627,7 +632,7 @@
                     -p "${Uopt:+$IPREFIX}$linepath$tmp2" \
 	            -s "${Uopt:+$ISUFFIX}" \
 	            -W "$prepath$realpath$testpath" \
-		    "$pfxsfx[@]" \
+		    "$pfxsfx[@]" $Mopts \
 	            $listopts \
 		    -a tmp1
           fi
@@ -636,7 +641,7 @@
 	  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 @@
 	  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 @@
 	  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 @@
         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 @@
         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


-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/



Messages sorted by: Reverse Date, Date, Thread, Author