Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Oddity when completing option arguments after command arguments
- X-seq: zsh-workers 42145
- From: dana <dana@xxxxxxx>
- To: Marko Myllynen <myllynen@xxxxxxxxxx>
- Subject: Re: Oddity when completing option arguments after command arguments
- Date: Tue, 19 Dec 2017 22:52:29 -0600
- Cc: zsh-workers@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dana-is.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=8gHpjGMda8ZJ6ZopOWWxGqmHMz8ik/UThSZrbYKLfQo=; b=OlNZBW/WihGG3MHwyrwqYU2Cm7/Y3YbehrTWVGhcDzazbTj/idwuPRyy8ju0pTtPBu 3jQ2kO2kMFPYjyN+FeBiZHEoA9UZBTxJTdQsWzDWxOSqCwSfGniYmKhC7yqAmYmG28V1 5M4M8b6rykT2gax8CUiQLAVSnrOAEWMT8AZrcI5FIgcsaCIKXJcy6S3Mc0OxO03IUb2I f4hGt3snwQlwpjyUfLrLQqeP3QhirBkjZhunXzG/lX1sVxlJEhrOCOhRJYxR9oAmabZ4 CNg2h/g3G4NFrzoCNp0T3htxslYW5DSfnfeavj1e0SJS/P3iWwVq/4/bCaCpEUYeQp4F KV6w==
- In-reply-to: <aa06fe49-e2e9-df25-14f0-3f6afe3cb56b@redhat.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <aa06fe49-e2e9-df25-14f0-3f6afe3cb56b@redhat.com>
On 18 Dec 2017, at 06:01, Marko Myllynen <myllynen@xxxxxxxxxx> wrote:
>This is with 5.4.1. What could explain this behavior, any suggestions
>how to fix this (so that in the last case would get only filenames)?
I think this would do it?
I didn't test *super* extensively, but it seems to behave as expected in all of
the cases listed, and it passes the existing checks.
dana
diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c
index 71d61563b..0b1ba58dc 100644
--- a/Src/Zle/computil.c
+++ b/Src/Zle/computil.c
@@ -2493,7 +2493,9 @@ ca_set_data(LinkList descr, LinkList act, LinkList subc,
* the case above right.
*/
if (arg->type == CAA_NORMAL &&
- opt && optdef && optdef->type == CAO_NEXT)
+ opt && optdef &&
+ (optdef->type == CAO_NEXT || optdef->type == CAO_ODIRECT ||
+ optdef->type == CAO_OEQUAL))
return;
if (single)
diff --git a/Test/Y03arguments.ztst b/Test/Y03arguments.ztst
index 7cbadfe8c..761b4b1d2 100644
--- a/Test/Y03arguments.ztst
+++ b/Test/Y03arguments.ztst
@@ -237,6 +237,27 @@
>NO:{-a}
>NO:{-b}
+ tst_arguments '*'{-x+,--xxx=}':optarg:(1)' '*:operand:(a)'
+ comptest $'tst \t'
+ comptest $'tst -x \t'
+ comptest $'tst -x\t'
+ comptest $'tst --xxx=\t'
+ comptest $'tst --xxx \t'
+ comptest $'tst a -x\t'
+ comptest $'tst a -x \t'
+ comptest $'tst a --xxx=\t'
+ comptest $'tst a --xxx \t'
+0:optarg completion following rest operand on line (workers/42141)
+>line: {tst a }{}
+>line: {tst -x 1 }{}
+>line: {tst -x1 }{}
+>line: {tst --xxx=1 }{}
+>line: {tst --xxx 1 }{}
+>line: {tst a -x1 }{}
+>line: {tst a -x 1 }{}
+>line: {tst a --xxx=1 }{}
+>line: {tst a --xxx 1 }{}
+
tst_arguments '-a' '*::rest:{compadd - -b}'
comptest $'tst arg -\t'
0:rest arguments
Messages sorted by:
Reverse Date,
Date,
Thread,
Author