From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11988 invoked from network); 20 Jul 1999 08:41:08 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 20 Jul 1999 08:41:08 -0000 Received: (qmail 23233 invoked by alias); 20 Jul 1999 08:40:51 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7216 Received: (qmail 23226 invoked from network); 20 Jul 1999 08:40:51 -0000 Date: Tue, 20 Jul 1999 10:40:46 +0200 (MET DST) Message-Id: <199907200840.KAA01075@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: Vin Shelton's message of 20 Jul 1999 00:58:22 -0400 Subject: PATCH: Re: Bad Variable Completion in test-2 Vin Shelton wrote: > There seems to be a bug in accept-and-menu-complete in test-2: > > : ~ Tue 20 0:51; /usr/local/zsh-3.1.6-test-2/bin/zsh -f > mithril% bindkey '^X\t' accept-and-menu-complete > mithril% echo $ZSH_^X > > This results in: > > mithril% echo $ZSH_NAME $$ZSH_VERSION > > Note the '$$' - not what was intended. That's with old style completion. The patch also fixes a problem with new style completion when the match had a suffix. Bye Sven diff -u os/Zle/zle_tricky.c Src/Zle/zle_tricky.c --- os/Zle/zle_tricky.c Tue Jul 20 08:54:19 1999 +++ Src/Zle/zle_tricky.c Tue Jul 20 10:28:06 1999 @@ -565,8 +565,9 @@ cs = minfo.pos + minfo.len + minfo.insc; iremovesuffix(' ', 1); l = cs; - cs = minfo.pos + minfo.len - (*(minfo.cur))->qisl; - foredel(l - cs); + cs = minfo.pos + minfo.len + minfo.insc - (*(minfo.cur))->qisl; + if (cs < l) + foredel(l - cs); inststrlen(" ", 1, 1); if (parpre) inststr(parpre); @@ -801,11 +802,12 @@ parq = eparq = 0; /* Save the prefix. */ - sav = *b; - *b = '\0'; - untokenize(parpre = ztrdup(s)); - *b = sav; - + if (incompfunc) { + sav = *b; + *b = '\0'; + untokenize(parpre = ztrdup(s)); + *b = sav; + } /* And adjust wb, we, and offs again. */ offs -= b - s; wb = cs - offs; -- Sven Wischnowsky wischnow@informatik.hu-berlin.de