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

Re: globcomplete desctroys file completion



On Sat, 21 Feb 2009 16:57:45 -0800
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> However, I suspect using $i there is only working in this specific
> example and not in the general case.  The resulting compadd looks
> like (line break added for readability):
> 
>     compadd -Qf -J -default- -J -default- -p Tmp/ -s '' -W Tmp/ \
>      -M 'r:|/=* r:|=*' -s /temp - texlive/temp
> 
> (and similarly for all the other files in texlive and texlive2008).
> That looks wrong to me in any case because the description of -W
> indicates that it's used "together with" -p ... but also note that
> we have two -s options, so something is rotten in tmp4 at line 668,
> is it not?

Indeed, comparing with the code in 4.2 (before the $Uopt stuff was added)
suggests it should probably be something like the following anyway,
though I don't have the set-up to test whether it helps here.

Index: Completion/Unix/Type/_path_files
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Type/_path_files,v
retrieving revision 1.42
diff -u -r1.42 _path_files
--- Completion/Unix/Type/_path_files	29 Jan 2009 17:58:30 -0000	1.42
+++ Completion/Unix/Type/_path_files	25 Feb 2009 20:37:16 -0000
@@ -665,10 +665,16 @@
       else
 	# We are inserting the match into the command line.
         if [[ "$tmp3" = */* ]]; then
-	  tmp4=( $Uopt -Qf "$mopts[@]" -p "${Uopt:+$IPREFIX}$linepath$tmp2"
-	         -s "${Uopt:+$ISUFFIX}"
+	  if [[ -n $Uopt ]]; then
+	    tmp4=( -Qf "$mopts[@]" -p "$IPREFIX$linepath$tmp2"
+	         -s "$ISUFFIX"
 	         -W "$prepath$realpath$testpath"
 	         "$pfxsfx[@]" $Mopts )
+	  else
+	    tmp4=( -Qf "$mopts[@]" -p "$linepath$tmp2"
+	      -W "$prepath$realpath$testpath"
+	      "$pfxsfx[@]" $Mopts )
+	  fi
 	  if [[ -z "$listsfx" ]]; then
             for i in "$tmp1[@]"; do
 	      tmpdisp=("${i%%/*}")


-- 
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