From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24456 invoked from network); 2 Aug 1999 09:47:42 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 2 Aug 1999 09:47:42 -0000 Received: (qmail 28274 invoked by alias); 2 Aug 1999 09:47:23 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7343 Received: (qmail 28267 invoked from network); 2 Aug 1999 09:47:23 -0000 Date: Mon, 2 Aug 1999 11:47:21 +0200 (MET DST) Message-Id: <199908020947.LAA12396@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: "Bart Schaefer"'s message of Tue, 27 Jul 1999 07:48:04 +0000 Subject: Re: PATCH: Re: CVS completer (Re: PATCH: Re: Completion/User functions again) 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 > F#bar F#baz > zsh% cvs add > zsh% cvs add F\# > (BEEP) > zsh% cvs add F\# > (BEEP) > zsh% cvs add F\# > zsh% cvs add F# > F#bar F#baz > zsh% cvs add F# > 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