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

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



Peter Stephenson wrote:

> This came out of my attempts to handle dd, but here's a simpler test.
> The [[ ... ]] stuck on its own looks funny, but it relies on the side
> effect on IPREFIX.
> 
> % defcomp stest
> % which __stest
> __stest () {
>         if [[ -iprefix name= ]]
>         then
>                 [[ -string , ]]
>                 complist -k '(yan tan tethera dick)'
>         fi
> }
> % 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.

I forgot to ignore the already ignored prefix for this kind of
condition.

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.

Bye
 Sven

--- os/Zle/compctl.c	Tue Feb  9 09:22:04 1999
+++ Src/Zle/compctl.c	Thu Feb 11 16:36:41 1999
@@ -2025,7 +2025,7 @@
 {
     if (comp_check()) {
 	char *s;
-	int i;
+	int i, ipl;
 
 	if (a[1]) {
 	    s = cond_str(a, 1);
@@ -2038,9 +2038,9 @@
 	    zerr("zle not loaded, zle condition not available", NULL, 0);
 	    return 1;
 	}
-	i = getcpatptr(comp_strptr(NULL, NULL), i, s, id);
+	i = getcpatptr(comp_strptr(&ipl, NULL), i, s, id);
 	if (i != -1) {
-	    ignore_prefix(i);
+	    ignore_prefix(i - ipl);
 	    return 1;
 	}
     }

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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