zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: PATCH: Re: CVS completer (Re: PATCH: Re: Completion/User functions again)
Date: Mon, 2 Aug 1999 11:47:21 +0200 (MET DST)	[thread overview]
Message-ID: <199908020947.LAA12396@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: "Bart Schaefer"'s message of Tue, 27 Jul 1999 07:48:04 +0000


Bart Schaefer wrote:

> There's still a bug, which may be a more general completion problem:  If the
> initial prefix of the completion contains a metacharacter (such as '#') that
> is inserted quoted, the completer thereafter does not match.  E.g.
> 
> zsh% cvs add <C-d>
> F#bar F#baz
> zsh% cvs add <TAB>
> zsh% cvs add F\#<TAB>
> (BEEP)
> zsh% cvs add F\#<C-d>
> (BEEP)
> zsh% cvs add F\#<C-b><DEL><C-e>
> zsh% cvs add F#<C-d>
> F#bar F#baz
> zsh% cvs add F#<TAB>
> zsh% cvs add F\#

Indeed. Due to the changed quoting rules in the completion code, we
should do the quoting of ppre and psuf in addmatches() earlier and
avoid quoting lpre/lsuf a second time altogether.

Bye
 Sven

diff -u os/Zle/zle_tricky.c Src/Zle/zle_tricky.c
--- os/Zle/zle_tricky.c	Mon Aug  2 11:44:54 1999
+++ Src/Zle/zle_tricky.c	Mon Aug  2 11:42:26 1999
@@ -3726,7 +3726,7 @@
 addmatches(Cadata dat, char **argv)
 {
     char *s, *ms, *lipre = NULL, *lisuf = NULL, *lpre = NULL, *lsuf = NULL;
-    char **aign = NULL, **dparr = NULL, oaq = autoq;
+    char **aign = NULL, **dparr = NULL, oaq = autoq, *oppre = dat->ppre;
     char *oqp = qipre, *oqs = qisuf, qc;
     int lpl, lsl, pl, sl, bpl, bsl, llpl = 0, llsl = 0, nm = mnum;
     int oisalt = 0, isalt, isexact, doadd, ois = instring, oib = inbackt;
@@ -3847,12 +3847,21 @@
 	    else if (lisuf)
 		dat->isuf = lisuf;
 	    if (dat->ppre) {
-		dat->ppre = dupstring(dat->ppre);
+		if (!(dat->aflags & CAF_QUOTE)) {
+		    dat->ppre = quotename(dat->ppre, NULL);
+		    if ((dat->flags & CMF_FILE) &&
+			dat->ppre[0] == '\\' && dat->ppre[1] == '~')
+			chuck(dat->ppre);
+		} else
+		    dat->ppre = dupstring(dat->ppre);
 		lpl = strlen(dat->ppre);
 	    } else
 		lpl = 0;
 	    if (dat->psuf) {
-		dat->psuf = dupstring(dat->psuf);
+		if (!(dat->aflags & CAF_QUOTE))
+		    dat->psuf = quotename(dat->psuf, NULL);
+		else
+		    dat->psuf = dupstring(dat->psuf);
 		lsl = strlen(dat->psuf);
 	    } else
 		lsl = 0;
@@ -3877,7 +3886,7 @@
 		    dat->pre = dupstring(dat->pre);
 		if (dat->suf)
 		    dat->suf = dupstring(dat->suf);
-		if (!dat->prpre && (dat->prpre = dat->ppre)) {
+		if (!dat->prpre && (dat->prpre = oppre)) {
 		    singsub(&(dat->prpre));
 		    untokenize(dat->prpre);
 		} else
@@ -3901,22 +3910,6 @@
 		    dat->rems = NULL;
 		} else if (dat->rems)
 		    dat->rems = dupstring(dat->rems);
-
-		/* Probably quote the prefix and suffix for testing. */
-		if (!(dat->aflags & CAF_QUOTE)) {
-		    if (!cp && (dat->aflags & CAF_MATCH)) {
-			lpre = quotename(lpre, NULL);
-			lsuf = quotename(lsuf, NULL);
-		    }
-		    if (dat->ppre) {
-			dat->ppre = quotename(dat->ppre, NULL);
-			if ((dat->flags & CMF_FILE) &&
-			    dat->ppre[0] == '\\' && dat->ppre[1] == '~')
-			    chuck(dat->ppre);
-		    }
-		    if (dat->psuf)
-			dat->psuf = quotename(dat->psuf, NULL);
-		}
 	    }
 	    /* Walk through the matches given. */
 	    for (; (s = *argv); argv++) {

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


             reply	other threads:[~1999-08-02  9:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-08-02  9:47 Sven Wischnowsky [this message]
  -- strict thread matches above, loose matches on Subject: below --
1999-07-21 11:27 Sven Wischnowsky
1999-07-21 15:54 ` Bart Schaefer
1999-07-25  9:23   ` Tanaka Akira
1999-07-26  4:48     ` Tanaka Akira
1999-07-26 16:26       ` Tanaka Akira
1999-07-26 17:10         ` Tanaka Akira
1999-07-27  7:48           ` PATCH: " Bart Schaefer
1999-07-27  8:12             ` Peter Stephenson
1999-07-27 10:07             ` Tanaka Akira
1999-07-27 11:45               ` Tanaka Akira
1999-07-27 13:49                 ` Bart Schaefer
1999-07-27 13:58                   ` Tanaka Akira
1999-07-27 14:11                     ` Tanaka Akira
1999-07-28 16:05                       ` Tanaka Akira

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=199908020947.LAA12396@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).