Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: _arguments -W fix
- X-seq: zsh-workers 42575
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Zsh workers <zsh-workers@xxxxxxx>
- Subject: PATCH: _arguments -W fix
- Date: Mon, 02 Apr 2018 23:23:03 +0200
- Authentication-results: amavisd4.gkg.net (amavisd-new); dkim=pass (2048-bit key) header.d=yahoo.co.uk
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1522704196; bh=udHnUWfTCxtkXFejx8Cnqk4kjJwjLBB0Pn/M0s4zIuQ=; h=From:To:Subject:Date:From:Subject; b=p9BO1MGzz2dAyYTkqXAkWtieXGEW73JSucoS2G1sx0y3Et9wrEGB0edY7Eb7mTCgMSahBMPhBYo99DgaRpG9JeTxrdpbTODUs4ttyPMDsIRcTcNgnrUqh0GtdwQlLdSL53psWUxIRlJk/faYCx9MJxlrrrwMgxNGomn5STcEKb/zhoM+97z5OwWv+JGoQjY8HV6RYpbQN/zXcfZV6Q88cbNfQeGaVvPqaCvHo4tBmAQEeff3zsajIweUFjKLY60m/PWPviq0zVtmyE9n1iZ5azVU1DPKhpSZM4ELL+L9WVnTKOkBM/Phb+Lilp/6GD4vpZ5qGusV53MAAmsYk1jlOg==
- 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
This fixes a bug introduced in 41824 that could cause options to be completed
in the argument to another option position.
The condition had originally been (lstate->doff && lstate->def). Much
of the 41824 changes relate to doff which is essentially the number of
characters moved to $IPREFIX. The original purpose of that condition
appears to only apply with _arguments' unusual -W option. That option
isn't covered in the tests.
Oliver
diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c
index 4ce8eeee5..2e86e5740 100644
--- a/Src/Zle/computil.c
+++ b/Src/Zle/computil.c
@@ -2675,7 +2675,7 @@ bin_comparguments(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
for (; lstate; lstate = lstate->snext) {
if (lstate->actopts &&
- (lstate->opt || lstate->def ||
+ (lstate->opt || (ca_doff && lstate->def) ||
(lstate->def && lstate->def->opt &&
(lstate->def->type == CAA_OPT ||
(lstate->def->type >= CAA_RARGS &&
diff --git a/Test/Y03arguments.ztst b/Test/Y03arguments.ztst
index 761b4b1d2..fa4589374 100644
--- a/Test/Y03arguments.ztst
+++ b/Test/Y03arguments.ztst
@@ -184,6 +184,12 @@
0:sticky option argument
>line: {tst -x }{}
+ tst_arguments '-x:arg' -y -z
+ comptest $'tst -x -\t'
+0:option argument with prefix that passes option prefix-needed test
+>line: {tst -x -}{}
+>DESCRIPTION:{arg}
+
tst_arguments '-x[desc]'
comptest $'tst -x\t'
0:end of option sequence
@@ -721,6 +727,15 @@ F:shouldn't offer -t in the first case (with stacked options)
>line: {tst --prefix=one }{}
>line: {tst --prefix=one --prop=}{}
+ tst_arguments -s -W -a+:arg -b
+ comptest $'tst -a\t'
+0:with -W options mixed with arguments
+>line: {tst -a}{}
+>DESCRIPTION:{arg}
+>DESCRIPTION:{option}
+>NO:{-b}
+
+
%clean
zmodload -ui zsh/zpty
Messages sorted by:
Reverse Date,
Date,
Thread,
Author