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

Re: compctl for export (with PATCH)



Matthew Lovell wrote:

> I'm using the following setup for completion on 'export':
> 
>   # for export, complete environment variables before the equal (=) sign, normal
>   # file system completion afterwards 
>   compctl -E -S '=' -x 'n[1,=]' -f -- export
> 
> If I wanted to extend MANPATH, for example, I could get completion on
> MANPATH before the equal sign, then $MANPATH after the equals and
> continue with some path specification afterwards.  This worked under
> zsh-3.1.4.
> 
> Under 3.1.6, however, adding a $ after the equals sign and asking for
> a completion erases _everything_ after 'export'.  Not quite the
> behavior I wanted.  
> 
> Does anyone have suggestions on how to cure this ill or pointers to
> relevant documentation for me?

That's a bug and below is the patch to fix this (I hope it's ok to
post this patch to zsh-users).

Bye
 Sven

diff -u os/Zle/zle_tricky.c Src/Zle/zle_tricky.c
--- os/Zle/zle_tricky.c	Mon Aug 23 11:42:11 1999
+++ Src/Zle/zle_tricky.c	Mon Aug 23 16:05:26 1999
@@ -801,9 +801,9 @@
 		isuf = dupstring(e);
 		untokenize(isuf);
 		*e = '\0';
-		ripre = dupstring(s);
+		ripre = dyncat((ripre ? ripre : ""), s);
+		ipre = dyncat((ipre ? ipre : ""), s);
 		ripre[b - s] = '\0';
-		ipre = dupstring(ripre);
 		untokenize(ipre);
 	    }
 	    else

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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