From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4742 invoked by alias); 15 Nov 2016 00:38:42 -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: 39945 Received: (qmail 2558 invoked from network); 15 Nov 2016 00:38:42 -0000 X-Qmail-Scanner-Diagnostics: from nm39-vm6.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.165):SA:0(-0.7/5.0):. Processed in 1.053773 secs); 15 Nov 2016 00:38:42 -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.7 required=5.0 tests=FREEMAIL_FROM, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,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.165 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1479169900; bh=ogFoB8UtdSFhOdqVo8U6hKxlYmjC4Ns6SSBWFjb0xes=; h=In-reply-to:From:References:To:Subject:Date:From:Subject; b=FX/rSPcqifyEhjbtx+gtdZQ2THMsSHOdnT5wpphQEl+zKS6svFQ1MUIroab4iB8O8WKiFtzdEsAKXidvlahTdj+jGKbljVeq+3EETGAGFBcSlSLdj224nlKJJNnWXmGt1JV31zH7QUmjFvKzkV5cQIReS0AnyPvAFTR+xk3c/HZsdELSYzoXig0PQByTUDq/Xso4unbZ/kkuRIw3vfjF2BlqiSzkF4LmcOxVLGlGAMPDn85j4J9IqdKSS2edDBJALDnsHPh4xodh2ydd2cZL4pPqM3BJ/8PZO43oG+quJoAutromm1wgCmBnzfifb7Yz5JTaKZZYvVKX0sB+44IOxQ== X-Yahoo-Newman-Id: 481700.21847.bm@smtp121.mail.ir2.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: qMd66ZwVM1kk5iYNUAOgvlpeHpLMA6mOddkAcAti2cJE_Kr OUgZn2UsTy7tyjBGwhY8a8RR4BD7QT2hwMo_neVvjlNHKjyt0Ut_ATES1Fn5 FULcXI32oTay2LeqVkn_pWGlZ_1DX5VSSJjgpF3t70xV3_J4y0Asxav04j5m Pux0KcSi9nn7xzukG1wM1szE2dEL4JFL.dH.FQ5UVAx0S4FBMd9qHUPu3r8l YdWg3PeOuMjGeWF7rKOirow9NLPe_dYHAwYzBjwngAnO8ejJzjDrTfklfwIh pfPBTyku_saMn3it8xsDKGzwMUprXfRIMx64qJUaF6AsKQ.atLrguXYX_X2Q pvODsxAUgvWhw_GkDwtMgIuEl72O5YWZ8IRFl85k7XoQMvDVz1NxHvhskfdF a_AvkBFzbhbbJF_t.WEUkrAbtPNe7UhJePimmQnlM67NZ7F_IKnsazN3Gp5i h527SKN.zyoBQ92xA6RdJOA4SlGN.xE4LDWOEkNemQ_3SoBbghZ2Vk7DzADi LyyTgHBgbfejZcpcKHTeJzE.K8kmtEoFPeBgU6ac- X-Yahoo-SMTP: opAkk_CswBAce_kJ3nIPlH80cJI- In-reply-to: <19772.1478217190@hydra.kiddle.eu> From: Oliver Kiddle References: <81D02BE7-7F8E-4E46-B7A9-95A5C9D8DDF7@kba.biglobe.ne.jp> <19772.1478217190@hydra.kiddle.eu> To: "Jun T." , zsh-workers@zsh.org Subject: Re: _arguments: normal arg spec with empty action MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <60846.1479169899.1@hydra.kiddle.eu> Date: Tue, 15 Nov 2016 01:31:39 +0100 Message-ID: <60847.1479169899@hydra.kiddle.eu> On 4 Nov, I wrote: > 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: This further patch covers these cases. There's many combinations of options and zstyles that might affect this. So to test with your configuration try repeated presses of for the following completion definition: compdef '_arguments --ab --ac :arg:' foo The first case is handled by making _message only clear compstate[insert] if the current value contains unambiguous. This makes sense for _message -e style messages because all we want to do is prevent the insertion of unambiguous characters (other characters may be relevant to the group indicated by the message). menu completion is not really a problem because it is inserting more characters than the unambiguous ones by definition. For BASH_AUTO_LIST, setting lastambig seems appropriate. It causes subsequent invocations of completion to set bashautolist. So first tab does nothing, second lists, third does menu completion if AUTO_MENU is set. Test cases have gone in Y03arguments because _arguments is the easiest way to test this but it doesn't really have much to do with _arguments. It's more about _message. Oliver diff --git a/Completion/Base/Core/_message b/Completion/Base/Core/_message index 13c8398..4d5645e 100644 --- a/Completion/Base/Core/_message +++ b/Completion/Base/Core/_message @@ -18,7 +18,8 @@ if [[ "$1" = -e ]]; then ret=0 done - (( $compstate[nmatches] )) || compstate[insert]= + (( ! $compstate[nmatches] )) && [[ $compstate[insert] = *unambiguous* ]] && + compstate[insert]= return ret fi diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c index 536bca7..d1cf7a0 100644 --- a/Src/Zle/compcore.c +++ b/Src/Zle/compcore.c @@ -425,6 +425,7 @@ do_completion(UNUSED(Hookdef dummy), Compldat dat) } } else { invalidatelist(); + lastambig = isset(BASHAUTOLIST); if (forcelist) clearlist = 1; zlemetacs = 0; diff --git a/Test/Y03arguments.ztst b/Test/Y03arguments.ztst index 3ada168..0763c41 100644 --- a/Test/Y03arguments.ztst +++ b/Test/Y03arguments.ztst @@ -243,6 +243,67 @@ >NO:{-a} >NO:{-b} + tst_arguments --abc --aah :arg: + comptesteval 'setopt bashautolist automenu' + comptest $'tst --a\t\t\t' +0:with message and bashautolist, a third tab will get menu completion +>line: {tst --a}{} +>line: {tst --a}{} +>DESCRIPTION:{arg} +>DESCRIPTION:{option} +>NO:{--aah} +>NO:{--abc} +>line: {tst --aah}{} + + tst_arguments --abc --aah :arg: + comptesteval 'setopt bashautolist noautomenu' + comptest $'tst --a\t\t\t' +0:with message and bashautolist, a third tab is needed to display the list +>line: {tst --a}{} +>line: {tst --a}{} +>DESCRIPTION:{arg} +>DESCRIPTION:{option} +>NO:{--aah} +>NO:{--abc} +>line: {tst --a}{} + + tst_arguments --abc --aah :arg: + comptesteval 'setopt nobashautolist noautomenu' + comptest $'tst --\t\t' +0:with message and noautomenu second tab redisplays the list +>line: {tst --}{} +>DESCRIPTION:{arg} +>DESCRIPTION:{option} +>NO:{--aah} +>NO:{--abc} +>line: {tst --}{} +>DESCRIPTION:{arg} +>DESCRIPTION:{option} +>NO:{--aah} +>NO:{--abc} + + tst_arguments --abc --aah :arg: + comptesteval 'setopt nobashautolist automenu' + comptest $'tst --\t\t' +0:with message two tabs will start menu completion +>line: {tst --}{} +>DESCRIPTION:{arg} +>DESCRIPTION:{option} +>NO:{--aah} +>NO:{--abc} +>line: {tst --aah}{} + + tst_arguments --abc --aah :arg: + comptesteval 'zstyle ":completion:*::::" completer _oldlist _complete' + comptest $'tst --\t\t' +0:with message and _oldlist, two tabs will start menu completion +>line: {tst --}{} +>DESCRIPTION:{arg} +>DESCRIPTION:{option} +>NO:{--aah} +>NO:{--abc} +>line: {tst --aah}{} + %clean zmodload -ui zsh/zpty