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

PATCH: Re: completion in braces



On 7 Oct, Danek Duvall wrote:
> Completion inside braces of filenames containing commas leaves the
> filenames improperly escaped:
> 
> % ls
> a,a  a,b  a,c  b,a  b,b  b,c
> % ls -l $PWD/{			Hit tab =>
> % ls -l $PWD/{a,a		Type comma/tab/tab =>

Following patch seems to fix this, at least for the new completion
system. But I'm no expert on what's going on in the completion code so
I'd be happier if someone else such as Sven could check this and perhaps
get it to work for the compctl system too.

Oliver

Index: Src/Zle/computil.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/computil.c,v
retrieving revision 1.83
diff -u -r1.83 computil.c
--- Src/Zle/computil.c	27 Aug 2002 21:10:34 -0000	1.83
+++ Src/Zle/computil.c	7 Nov 2002 16:29:53 -0000
@@ -3345,6 +3345,20 @@
     if (x)
 	*str = *ret = '=';
 
+    /* quote commas inside brace expansions */
+    if (brbeg) {
+	char *u = ret;
+	char *v;
+
+	v = ret = hcalloc(2 * strlen(u) + 1);
+	while (*u) {
+            if (*u == ',')
+        	*v++ = '\\';
+            *v++ = *u++;
+	}
+	*v = '\0';
+    }
+
     return ret;
 }
 

This e-mail and any attachment is for authorised use by the intended recipient(s) only.  It may contain proprietary material, confidential information and/or be subject to legal privilege.  It should not be copied, disclosed to, retained or used by, any other party.  If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender.  Thank you.



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