zsh-workers
 help / color / mirror / code / Atom feed
* completion in braces
@ 2002-10-08  4:58 Danek Duvall
  2002-11-07 16:43 ` PATCH: " Oliver Kiddle
  0 siblings, 1 reply; 3+ messages in thread
From: Danek Duvall @ 2002-10-08  4:58 UTC (permalink / raw)
  To: Zsh Workers

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 =>
% ls -l $PWD/{a,a,a,b

And so forth.  That should probably look like

% ls -l $PWD/{a\,a		Type comma/tab/tab =>
% ls -l $PWD/{a\,a,a\,b

Is that possible?

I'm seeing this on 4.0.3 and 4.0.5, and I can reproduce it with a plain
zsh -f, followed by "autoload -U compinit; compinit -i".

Thanks,
Danek


^ permalink raw reply	[flat|nested] 3+ messages in thread

* PATCH: Re: completion in braces
  2002-10-08  4:58 completion in braces Danek Duvall
@ 2002-11-07 16:43 ` Oliver Kiddle
  2002-11-11  9:03   ` Sven Wischnowsky
  0 siblings, 1 reply; 3+ messages in thread
From: Oliver Kiddle @ 2002-11-07 16:43 UTC (permalink / raw)
  To: Danek Duvall; +Cc: Zsh Workers

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.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PATCH: Re: completion in braces
  2002-11-07 16:43 ` PATCH: " Oliver Kiddle
@ 2002-11-11  9:03   ` Sven Wischnowsky
  0 siblings, 0 replies; 3+ messages in thread
From: Sven Wischnowsky @ 2002-11-11  9:03 UTC (permalink / raw)
  To: zsh-workers


Apologies for not replying to the original post earlier. I meant to
answer it, even had a look at the code, couldn't find a good solution
and then got drowned by real work again.

Oliver Kiddle wrote:

> 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.

The problem with the patch is that it fixes it only for the (few)
cases where the completion code uses the compquote builtin. A better
solution would be to add the change at the place where the completion
or the unambiguous string is inserted into the line (in cline_str()
and instmatch() in compresult.c). But that's not trivial (finding the
commas that have to be quoted, ignoring those that don't have to be
quoted). It was at that place where I didn't find a good solution...
(from the code's point of view). And it's still the same, so no patch
yet.


Bye
  Sven

-- 
Sven Wischnowsky                          wischnow@berkom.de


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-11-11  9:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-08  4:58 completion in braces Danek Duvall
2002-11-07 16:43 ` PATCH: " Oliver Kiddle
2002-11-11  9:03   ` Sven Wischnowsky

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).