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

Re: PATCH: Re: Bad interaction between -iprefix and -string



I wrote:

> Peter Stephenson wrote:
> 
> > % stest name=y<TAB>                # produces...
> > % stest name=yan                   # OK so far, add `,te' by hand...
> > % stest name=yan,te<TAB>           # produces...
> > % stest name=yan,tedick            # The te is being ignored, too.
> 
> Stuff like the above makes me think that even more control over the
> inserted suffixes would be nice. In this case: make a `,' fall in
> place automatically.

That was nonsense, of course. This:

  __stest () {
        if [[ -iprefix name= ]]
        then
                [[ -string , ]]
		compadd -qr ',' -S ' ' -m yan tan tethera dick
        fi
  }

should work perfectly well. But at least trying it revealed two bugs:
with the `-m' option compadd should use IPREFIX and in addmatches()
(which is the function used for compadd) we shouldn't tokenize the
contents of the completion variables.

With the patch below, it works.

Bye
 Sven

--- os/Zle/zle_tricky.c	Mon Feb  8 13:18:36 1999
+++ Src/Zle/zle_tricky.c	Thu Feb 11 17:31:46 1999
@@ -2489,16 +2489,15 @@
     SWITCHHEAPS(compheap) {
 	HEAPALLOC {
 	    if (aflags & CAF_MATCH) {
-		ctokenize(lipre = dupstring(compiprefix));
-		remnulargs(lipre);
-		ctokenize(lpre = dupstring(compprefix));
-		remnulargs(lpre);
+		lipre = dupstring(compiprefix);
+		lpre = dupstring(compprefix);
 		llpl = strlen(lpre);
-		ctokenize(lsuf = dupstring(compsuffix));
-		remnulargs(lsuf);
+		lsuf = dupstring(compsuffix);
 	    }
 	    if (ipre)
 		ipre = (lipre ? dyncat(lipre, ipre) : dupstring(ipre));
+	    else if (lipre)
+		ipre = lipre;
 	    if (ppre) {
 		ppre = dupstring(ppre);
 		lpl = strlen(ppre);

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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