zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: Re: _path_files and variables
@ 1999-03-09 13:46 Sven Wischnowsky
  0 siblings, 0 replies; only message in thread
From: Sven Wischnowsky @ 1999-03-09 13:46 UTC (permalink / raw)
  To: zsh-workers


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@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1999-03-09 13:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-03-09 13:46 PATCH: Re: _path_files and variables 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).