From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1201 invoked by alias); 27 Sep 2017 11:01:36 -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: 41772 Received: (qmail 28346 invoked by uid 1010); 27 Sep 2017 11:01:36 -0000 X-Qmail-Scanner-Diagnostics: from sonic310-12.consmr.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(77.238.177.33):SA:0(-1.9/5.0):. Processed in 5.167386 secs); 27 Sep 2017 11:01:36 -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=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_PASS, T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: okiddle@yahoo.co.uk X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1506510085; bh=ReVULjDQvgwatLz+7EXA1aNEa3oFmCa6pDGA0veeUPs=; h=From:To:Subject:Date:From:Subject; b=otPeO1F94eMAgefq/N5YU+v1QKgEVYdbt/OtUomXXIkxh3nHq+7nWXM1ED4npaImfyWlIL9Owoake1e8mR1AC+Y2ZYHpvRnmwQdlEPcopec/55TQ3zhLitu9YcT1HNWeXlQ63jXfjBvmfSWS+U0Nuskie1kcXm0wMcHiAJxjArAOI3MV5XrZ4SrSfe52dMXavprBVThY+4NOa3Nt6nGZd48j0ntwjZe2w8kEfmjB/qAzYiTTcJdEnVCFL36c0lDXEpQlcWP1nGNFPsUEPaWaNQEMWVMb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24hm.kfPfny8GZOhtozU K.eqtFmj0fqOP4bittrPfT2Oo5fdm.tPCqU9qsVODGIoXi6FtqAQYvy3Lhef TKeQcLZzxajEqlq8hXwf3pvtjV4ZYMta1zdAtT3Lm1VhRnQ-- X-Yahoo-SMTP: opAkk_CswBAce_kJ3nIPlH80cJI- From: Oliver Kiddle To: Zsh workers Subject: PATCH: long options and _arguments -A MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <20849.1506504668.1@thecus.kiddle.eu> Date: Wed, 27 Sep 2017 11:31:08 +0200 Message-ID: <20850.1506504668@thecus.kiddle.eu> This fixes a bug introduced in 40269. _arguments' -A option was not taking account of long options. ca_inactive only gets called with opts set for -S and -A conditions which only apply for preceding words. 40269 added special handling to allow for the current word being a prefix of a longer one: don't apply exclusions from -x as it could be the prefix of -xy. Oliver diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c index e704f9ffa..0368a07d0 100644 --- a/Src/Zle/computil.c +++ b/Src/Zle/computil.c @@ -1824,7 +1824,7 @@ ca_inactive(Cadef d, char **xor, int cur, int opts) char *x; /* current word could be a prefix of a longer one so only do * exclusions for single-letter options (for option clumping) */ - int single = (cur == compcurrent); + int single = !opts && (cur == compcurrent); for (; (x = (opts ? "-" : *xor)); xor++) { int excludeall = 0; diff --git a/Test/Y03arguments.ztst b/Test/Y03arguments.ztst index 25bb96b84..94ce8361e 100644 --- a/Test/Y03arguments.ztst +++ b/Test/Y03arguments.ztst @@ -333,6 +333,12 @@ 0:option after a word >line: {tst word -x }{} + tst_arguments -A '-*' -x --extra ::first + comptest $'tst word -\t' +0:long option after word that doesn't match -A pattern +>line: {tst word -}{} +>MESSAGE:{no more arguments} + tst_arguments -A'-*' -x :word comptest $'tst word -\t' 0:option after word that doesn't match -A pattern, no space before pattern .