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

Re: zsh-3.1.5-pws-19 unquotes prefix.



Tanaka Akira wrote:

> Z(2):akr@is27e1u11% ./Src/zsh -f
> is27e1u11% fpath=($PWD/Completion/*(/))
> is27e1u11% . Completion/Core/compinit
> is27e1u11% _tst () { compset -P '\*' && compadd -- a }
> is27e1u11% _comps[tst]=_tst
> is27e1u11% tst \*<TAB>
> 
> I get following.
> 
> is27e1u11% tst *a 
> 
> I think that zsh sould not unquote *.
> 
> is27e1u11% tst \*a 

That was one problem. The other was that with old completion and
`compctl -P '\*' -k '(a b)' foo', completion after `ls \*<TAB>' didn't 
work at all.

Again, completion and quoting, sigh.

Bye
 Sven

--- os/Zle/zle_tricky.c	Fri May 21 23:47:01 1999
+++ Src/Zle/zle_tricky.c	Tue May 25 19:40:22 1999
@@ -3596,8 +3596,13 @@
 	    /* Get the contents of the completion variables if we have
 	     * to perform matching. */
 	    if (dat->aflags & CAF_MATCH) {
-		lipre = dupstring(compiprefix);
-		lisuf = dupstring(compisuffix);
+		if (dat->aflags & CAF_QUOTE) {
+		    lipre = dupstring(compiprefix);
+		    lisuf = dupstring(compisuffix);
+		} else {
+		    lipre = quotename(compiprefix, NULL);
+		    lisuf = quotename(compisuffix, NULL);
+		}
 		lpre = dupstring(compprefix);
 		lsuf = dupstring(compsuffix);
 		llpl = strlen(lpre);
@@ -5324,10 +5329,11 @@
 	int pl = 0;
 
 	if (*s) {
+	    char *dp = rembslash(cc->prefix);
 	    /* First find out how much of the prefix is already on the line. */
 	    sd = dupstring(s);
 	    untokenize(sd);
-	    pl = pfxlen(cc->prefix, sd);
+	    pl = pfxlen(dp, sd);
 	    s += pl;
 	    sd += pl;
 	    offs -= pl;
@@ -5335,7 +5341,7 @@
     }
     /* Does this compctl have a suffix (compctl -S)? */
     if (cc->suffix) {
-	char *sdup = dupstring(cc->suffix);
+	char *sdup = rembslash(cc->suffix);
 	int sl = strlen(sdup), suffixll;
 
 	/* Ignore trailing spaces. */

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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