Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: long options and _arguments -A
- X-seq: zsh-workers 41772
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Zsh workers <zsh-workers@xxxxxxx>
- Subject: PATCH: long options and _arguments -A
- Date: Wed, 27 Sep 2017 11:31:08 +0200
- 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/qAzYiTTcJdEnVCFL36c0lDXEpQlcWP1nGNFPsUEPaWaNQEMWVMbpRJDm40v03vd+U29HQNtHQF45uv8hqlkxI8La9h3jpsKVnybacsJj2FAGQ==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
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
.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author