zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: long options and _arguments -A
@ 2017-09-27  9:31 Oliver Kiddle
  0 siblings, 0 replies; only message in thread
From: Oliver Kiddle @ 2017-09-27  9:31 UTC (permalink / raw)
  To: Zsh workers

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

.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-09-27 11:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-27  9:31 PATCH: long options and _arguments -A Oliver Kiddle

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).