From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21446 invoked by alias); 3 Nov 2016 23:59:06 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 39829 Received: (qmail 10978 invoked from network); 3 Nov 2016 23:59:06 -0000 X-Qmail-Scanner-Diagnostics: from nm40-vm1.bullet.mail.ir2.yahoo.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(212.82.97.169):SA:0(0.0/5.0):. Processed in 0.609528 secs); 03 Nov 2016 23:59:06 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=FREEMAIL_FROM,SPF_PASS, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: okiddle@yahoo.co.uk X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.mail.yahoo.com designates 212.82.97.169 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1478217190; bh=K1cOZizo0sBkaAFFeRepdIWLZ9R9J76l+rqeoOZN0ms=; h=cc:In-reply-to:From:References:To:Subject:Date:From:Subject; b=IvR0pnQZY9oJJwYt3fzcDmAUK1de5lU8e9n5+T7IQ9nDzJu6DvvQ5YZhGQX2TeIQ9ZTWGakGBPlY0GPQrISracvKNWWQe+ge0gyDnAUvtr7QtOUFyllPDiAfEVsWd8hG2zvYpWvrsPz0O9/P8mRoDSrMcoCxw0xv1YpG1YJIsN8FPq5VrMjtYCj7I7Ru84gOlqS7QLDcniJlAIDOCGUgx63szxSbitBh5fBukzKypRrnl31kDLSe4MChfZe71JxSKAgNqJLSJYVhYhOy2VafLr+dadMoKp2qIrIj67Eywu8sw1Vz9qjjYeD0W/JWfok88n8LQolDnggTEK/AklepaQ== X-Yahoo-Newman-Id: 931266.54446.bm@smtp148.mail.ir2.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: XurofbYVM1mhoc_KJJPzRHDXLvSe_66P32Ts7CMWOtCrCCl iMYAonwrKhEOjYovBzp_eIJZOBDD7j_scFF059QA7TWGMhwqEYSoB2KFPHad wGLrhy1o5TMd3I7T36ij5cwUenpQjktGeRNvOjv7fPGx7gXjg4yMkR2vNBVU hjpdE7S8aU4nzDQGHXCYeZj3K2AqjU.HvI2M1s4w2ileJViOkkmKi2yy1fUe yt7dxTLHP6wY3fPcYTp3Rms01h2Xf_3yIoDxl1SjPMcYLZsN0_nXrrVa0Jyp fjvU2H.CZMv8xBUZKil08bO3BBTh.mv2iFAx3dKq2rejmyvkb.Xg2vDcieVb RUsRKYTDK9a4VHQJjE93r9bZvKPc4P2qufavoFJAHPCMFoAxA4.k7pAxVcR5 sHyiDTvVyti9bw1EWCX79KKbGnN0CRyMPQZFajvQ7_TOPfAW5jkUiwgipVef HjuRdNa540G8qRHZOuefnow0tLbGT4QJNNWWbfUtXw0HilogUVoxBBp4XIwd YWYhJztWgkhWyGUmWz1Fs058maGnOI7ESKICHhLdUOWg- X-Yahoo-SMTP: opAkk_CswBAce_kJ3nIPlH80cJI- cc: zsh-workers@zsh.org In-reply-to: <81D02BE7-7F8E-4E46-B7A9-95A5C9D8DDF7@kba.biglobe.ne.jp> From: Oliver Kiddle References: <81D02BE7-7F8E-4E46-B7A9-95A5C9D8DDF7@kba.biglobe.ne.jp> To: "Jun T." Subject: Re: _arguments: normal arg spec with empty action MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <19771.1478217190.1@hydra.kiddle.eu> Date: Fri, 04 Nov 2016 00:53:10 +0100 Message-ID: <19772.1478217190@hydra.kiddle.eu> On 18 Oct, "Jun T." wrote: > If I type > > zsh% awk - > > then it shows the list of options (-F -f -v), as expected. > But if I hit again, it does not cycle through the options. > > It seems this is caused by the empty action in the spec: > '1:program text:' I took a closer look at this. The reason I couldn't reproduce it is that I use _oldlist in my list of completers. Still, I need a third tab to get menu completion which didn't seem right. Normally, a first tab will insert an unambiguous prefix, the second does the list and the third goes to menu completion. An empty action spec such as that above results in _message doing compstate[insert]=''. This forces listing and ensures that nothing is inserted so that the user can see that "program text" is a valid thing to insert at this point. So the first tab does the listing, the second still won't insert any unambiguous prefix but completion does record that that stage is done so the third will start menu completion. This patch adds some logic so that when compstate[insert] is found to be empty, and AUTO_MENU is set, it knows that it can consider the unambiguous insert bit done. This doesn't help if you don't use _oldlist because compstate[insert] gets cleared for every tab press. I also noticed when doing testing that with the BASH_AUTO_LIST option you never get anything useful at all for functions that clear compstate[insert]. I'm surprised we haven't had complaints about that: zsh -f autoload -U compinit; compinit setopt bash_auto_list grep - Oliver diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c index 5443018..d7fbea5 100644 --- a/Src/Zle/compcore.c +++ b/Src/Zle/compcore.c @@ -835,6 +835,7 @@ callcompfunc(char *s, char *fn) endparamscope(); lastcmd = 0; incompfunc = icf; + startauto = 0; if (!complist) uselist = 0; @@ -882,8 +883,13 @@ callcompfunc(char *s, char *fn) useline = 1, usemenu = 1; else if (strpfx("auto", compinsert)) useline = 1, usemenu = 2; - else + else { useline = usemenu = 0; + /* if compstate[insert] was emptied, no unambiguous prefix + * ever gets inserted so allow the next tab to already start + * menu completion */ + startauto = lastambig = isset(AUTOMENU); + } if (useline && (p = strchr(compinsert, ':'))) { insmnum = atoi(++p); @@ -896,7 +902,7 @@ callcompfunc(char *s, char *fn) #endif } } - startauto = ((compinsert && + startauto = startauto || ((compinsert && !strcmp(compinsert, "automenu-unambiguous")) || (bashlistfirst && isset(AUTOMENU) && (!compinsert || !*compinsert)));