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

PATCH: _arguments with multiple sets



Oliver pointed out to me that completion after `compdef -' was buggy
because the `-a' and `-n' options were listed multiple times.  That's
a result of _compdef using _arguments with multiple sets and the
C-code not removing multple identical specs reported back to the shell
code.  Here's a patch for that.


Bye
  Sven

Index: Src/Zle/computil.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/computil.c,v
retrieving revision 1.73
diff -u -r1.73 computil.c
--- Src/Zle/computil.c	2001/08/08 07:44:00	1.73
+++ Src/Zle/computil.c	2002/01/08 15:26:04
@@ -2315,6 +2315,7 @@
 	    LinkList direct = newlinklist();
 	    LinkList odirect = newlinklist();
 	    LinkList equal = newlinklist(), l;
+            LinkNode node;
 	    Caopt p;
 	    char *str;
 	    int ret = 1;
@@ -2349,7 +2350,13 @@
 				strcat(str, p->descr);
 			    } else
 				str = bslashcolon(p->name);
-			    addlinknode(l, str);
+
+                            for (node = firstnode(l); node; incnode(node))
+                                if (!strcmp(str, (char *) getdata(node)))
+                                    break;
+
+                            if (!node)
+                                addlinknode(l, str);
 			}
 		    }
 		}

-- 
Sven Wischnowsky                           wischnow@xxxxxxxxx



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