From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12700 invoked from network); 12 Dec 2004 16:16:00 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 12 Dec 2004 16:16:00 -0000 Received: (qmail 42585 invoked from network); 12 Dec 2004 16:15:53 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 12 Dec 2004 16:15:53 -0000 Received: (qmail 25172 invoked by alias); 12 Dec 2004 16:15:39 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 20620 Received: (qmail 25154 invoked from network); 12 Dec 2004 16:15:37 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 12 Dec 2004 16:15:37 -0000 Received: (qmail 41223 invoked from network); 12 Dec 2004 16:15:37 -0000 Received: from mx2.mail.ru (194.67.23.122) by a.mx.sunsite.dk with SMTP; 12 Dec 2004 16:15:36 -0000 Received: from [83.237.228.91] (port=32876 helo=ppp83-237-228-91.pppoe.mtu-net.ru) by mx2.mail.ru with asmtp id 1CdWNj-000Gvj-00 for zsh-workers@sunsite.dk; Sun, 12 Dec 2004 19:15:35 +0300 From: Andrey Borzenkov To: zsh-workers@sunsite.dk Subject: Re: Strange _values completion on accept-and-menu-complete and menu selection Date: Sun, 12 Dec 2004 19:15:33 +0300 User-Agent: KMail/1.7.1 References: <200412111311.27916.arvidjaar@mail.ru> In-Reply-To: MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200412121915.34004.arvidjaar@mail.ru> X-Spam: Not detected X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=0.0 required=6.0 tests=none autolearn=no version=2.63 X-Spam-Hits: 0.0 On Sunday 12 December 2004 00:05, Bart Schaefer wrote: > A fix seems to be something in the direction of this pseudo-patch (do NOT > apply it as-is) to compresult.c, but I don't know how to get the boolean > value for "we are not completing values from compvalues" at this location. > I already got a prototype patch for it when I accidentally hit a-a-i-n-h and voila - it did what I expected from a-a-m-c (except that a-a-m-c stays on the same word while a-a-i-n-h starts from scratch - because with a-a-i-n-h it actually starts new completion every time). I attach prototype patch - it adds compstate element that tells accept_last to skip suffix removal. It can be used in more general case than just _values - what I am not sure how and when this is to be set. I.e. using this patch following function now "correctly" works for a-a m-c: function _foo () { compstate[stayinword]=1 compset -P '*,' compadd -qS , ${(k)compstate} } compdef _foo foo regards -andrey Index: Src/Zle/complete.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/complete.c,v retrieving revision 1.27 diff -u -p -r1.27 complete.c --- Src/Zle/complete.c 7 Dec 2004 16:55:11 -0000 1.27 +++ Src/Zle/complete.c 12 Dec 2004 16:13:03 -0000 @@ -38,7 +38,8 @@ zlong compcurrent, complistmax; /**/ zlong complistlines, - compignored; + compignored, + compstayinword; /**/ mod_export @@ -1018,6 +1019,7 @@ static struct compparam compkparams[] = { "list_lines", PM_INTEGER | PM_READONLY, NULL, GSU(listlines_gsu) }, { "all_quotes", PM_SCALAR | PM_READONLY, VAL(compqstack), NULL }, { "ignored", PM_INTEGER | PM_READONLY, VAL(compignored), NULL }, + { "stayinword", PM_INTEGER, VAL(compstayinword), NULL }, { NULL, 0, NULL, NULL } }; Index: Src/Zle/compresult.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/compresult.c,v retrieving revision 1.52 diff -u -p -r1.52 compresult.c --- Src/Zle/compresult.c 12 Jul 2004 10:05:52 -0000 1.52 +++ Src/Zle/compresult.c 12 Dec 2004 16:13:04 -0000 @@ -1243,14 +1243,16 @@ accept_last(void) int l; cs = minfo.pos + minfo.len + minfo.insc; - iremovesuffix(' ', 1); + if (!compstayinword) + iremovesuffix(' ', 1); l = cs; cs = minfo.pos + minfo.len + minfo.insc - (*(minfo.cur))->qisl; if (cs < l) foredel(l - cs); else if (cs > ll) cs = ll; - inststrlen(" ", 1, 1); + if (!compstayinword) + inststrlen(" ", 1, 1); minfo.insc = minfo.len = 0; minfo.pos = cs; minfo.we = 1;