zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: PATCH: Re: _path_files and variables
Date: Tue, 9 Mar 1999 14:46:50 +0100 (MET)	[thread overview]
Message-ID: <199903091346.OAA14476@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: "Andrej Borsenkow"'s message of Tue, 9 Mar 1999 15:15:34 +0300


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


                 reply	other threads:[~1999-03-09 13:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199903091346.OAA14476@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).