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

PATCH: Re: _path_files and variables



Andrej Borsenkow wrote:

> bor@itsrm2:~%> cd /tools/bin
> bor@itsrm2:/tools/bin%> l ${PWD}/z
> Beep
> 
> but
> 
> bor@itsrm2:/tools/bin%> zsh -f    
> itsrm2% l ${PWD}/z
> zip*               zipinfo*           zsh*               zsh-3.1.5-pws-8*
> zipcloak*          zipnote*           zsh-3.1.5-pws-10*  zsh-3.1.5-pws-9*
> zipgrep*           zipsplit*          zsh-3.1.5-pws-11*  zsh.old*
> 
> I quite often used completion at least with $PWD

I removed this when adding the `parameter' context -- too happy to
remove `ctokenize()'. But, yes, maybe we should put (a slightly
simplified version of) it back, to get this to work again.

> And I suspect, that the following will break (sigh ...):
> 
> ${PWD/foo/bar}/TAB
> 
> not that I expect it to be used so often :-)

But that always worked (with old completion, and with the patch below
with new completion, too, again)...

Bye
 Sven

diff -u os/Zle/zle_tricky.c Src/Zle/zle_tricky.c
--- os/Zle/zle_tricky.c	Tue Mar  9 11:33:29 1999
+++ Src/Zle/zle_tricky.c	Tue Mar  9 14:43:43 1999
@@ -5430,6 +5430,32 @@
 /* This should probably be moved into tokenize(). */
 
 /**/
+static char *
+ctokenize(char *p)
+{
+    char *r = p;
+    int bslash = 0;
+
+    tokenize(p);
+
+    for (p = r; *p; p++) {
+	if (*p == '\\')
+	    bslash = 1;
+	else {
+	    if (*p == '$' || *p == '=' || *p == '{' || *p == '}') {
+		if (bslash)
+		    p[-1] = Bnull;
+		else
+		    *p = (*p == '$' ? String :
+			  (*p == '{' ? Inbrace : Outbrace));
+	    }
+	    bslash = 0;
+	}
+    }
+    return r;
+}
+
+/**/
 char *
 comp_str(int *ipl, int *pl, int untok)
 {
@@ -5440,11 +5466,11 @@
     int lp, ls, lip;
 
     if (!untok) {
-	tokenize(p);
+	ctokenize(p);
 	remnulargs(p);
-	tokenize(s);
+	ctokenize(s);
 	remnulargs(s);
-	tokenize(ip);
+	ctokenize(ip);
 	remnulargs(ip);
     }
     ls = strlen(s);

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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