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

Re: Multipart completion problem?



Andrej Borsenkow wrote:

> With all post-pws-13 patches
> 
> bor@itsrm2:/tools/src/zsh-3.1.5-pws-13%> zsh -f
> itsrm2% fpath=($PWD/Completion/*(/))     
> itsrm2% . Completion/Core/compinit
> itsrm2% ./configure --pre=/toTAB
> itsrm2% ./configure --prefix=to
> 
> Where is the slash?

Hey, I could immediatly reproduce that ;-)

The missing slash was caused by a incomplete pattern when weeding out
the names not matching what's on the line. And in another place the
same could cause problems. Finally the test if the string didn't
change had problems when the string from the line contained a trailing 
slash.

And then I realised that this is a case where there is non-path
ignored prefix where the code in `do_single()' failed -- something I
foresaw yesterday, but couldn't immediatly come up with an example for
(in my big patch I had only looked at `do_ambiguous()' because I
didn't need to change `do_single()'). So the patch also cleans that -- 
rather drastically.

Bye
 Sven

diff -u -r oc/Core/_path_files Completion/Core/_path_files
--- oc/Core/_path_files	Tue Mar 23 11:56:57 1999
+++ Completion/Core/_path_files	Tue Mar 23 13:27:02 1999
@@ -239,7 +239,7 @@
 # to `donepath'.
 
 while [[ "$orig" = */* ]] do
-  tmp1=( $realpath$donepath${orig%%/*}/${~matchflags}${~patstr#*/}$^pats )
+  tmp1=( $realpath$donepath${orig%%/*}/${~matchflags}${~patstr#*/}${^~pats} )
   tmp1=("${(@M)tmp1:#$~patlast}")
   [[ $#tmp1 -gt 0 && -e "$realpath$donepath${orig%%/*}" ]] || break
   donepath="$donepath${orig%%/*}/"
@@ -424,7 +424,7 @@
   suffixes=( $str$^pats )
   suffixes=( "${(@)suffixes:gs.**.*.}" )
   tmp2=( ${~tmp1}${~matchflags}${~suffixes} )
-  tmp2=("${(@M)tmp2:#$~patlast}")
+  tmp2=("${(@M)tmp2:#${tmp1}$~patlast}")
 
   if [[ $#tmp2 -eq 0 ]]; then
     # No match, insert the expanded path and add the original tail.
@@ -434,7 +434,7 @@
     [[ -n "$ostr" && -n "$linepath$testpath" ]] && ostr="/$ostr"
 
     # But only if something changed.
-    [[ "$linepath$testpath$ostr" = "$PREFIX$SUFFIX" ]] && return 1
+    [[ "${PREFIX}${SUFFIX}" = $linepath$testpath$ostr(|/) ]] && return 1
 
     compadd -QU -S '' "$group[@]" "$expl[@]" \
             -i "$IPREFIX" -I "$ISUFFIX" -f - "$linepath${testpath:q}$ostr"
diff -u os/Zle/zle_tricky.c Src/Zle/zle_tricky.c
--- os/Zle/zle_tricky.c	Tue Mar 23 11:57:08 1999
+++ Src/Zle/zle_tricky.c	Tue Mar 23 13:06:48 1999
@@ -6766,38 +6766,10 @@
 	    char *p;
 
 	    /* Build the path name. */
-	    if (haspattern || ic || m->ripre) {
-		int ne = noerrs;
+	    p = (char *) zhalloc(strlen(prpre) + strlen(str) +
+				 strlen(psuf) + 3);
+	    sprintf(p, "%s%s%s", (prpre && *prpre) ? prpre : "./", str, psuf);
 
-		noerrs = 1;
-
-		if (m->ripre) {
-		    int pl = strlen(m->ripre);
-
-		    p = (char *) zhalloc(pl + strlen(str) + strlen(psuf) + 1);
-		    sprintf(p, "%s%s%s", m->ripre, str, psuf);
-		    if (pl && p[pl-1] == Inbrace)
-			strcpy(p+pl-1, p+pl);
-		} else if (ic) {
-		    p = (char *) zhalloc(strlen(prpre) + strlen(str) +
-					 strlen(psuf) + 2);
-		    sprintf(p, "%c%s%s%s", ic, prpre, str, psuf);
-		} else {
-		    p = (char *) zhalloc(strlen(prpre) + strlen(str) +
-					 strlen(psuf) + 1);
-		    sprintf(p, "%s%s%s", prpre, str, psuf);
-		}
-		parsestr(p);
-		if (ic)
-		    *p = ic;
-		singsub(&p);
-
-		noerrs = ne;
-	    } else {
-		p = (char *) zhalloc(strlen(prpre) + strlen(str) +
-				     strlen(psuf) + 3);
-		sprintf(p, "%s%s%s", (prpre && *prpre) ? prpre : "./", str, psuf);
-	    }
 	    /* And do the stat. */
 	    if (!(sr = ztat(p, &buf, 0)) && S_ISDIR(buf.st_mode)) {
 		/* It is a directory, so add the slash. */

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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