summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Kiddle <okiddle@yahoo.co.uk>2018-04-05 11:14:58 +0200
committerOliver Kiddle <okiddle@yahoo.co.uk>2018-04-05 11:14:58 +0200
commit25da576c292b7ff84a34fa8aee70ff7c7d9e2ba1 (patch)
tree02f3ee707137e4b04526e6963a611a81add4c93b
parent35734810d1b042ca1fb4508ae3813ef999ff1aa9 (diff)
downloadzsh-25da576c292b7ff84a34fa8aee70ff7c7d9e2ba1.tar.gz
zsh-25da576c292b7ff84a34fa8aee70ff7c7d9e2ba1.tar.xz
zsh-25da576c292b7ff84a34fa8aee70ff7c7d9e2ba1.zip
42575: fix to not complete options in the argument to another option
-rw-r--r--ChangeLog5
-rw-r--r--Src/Zle/computil.c2
-rw-r--r--Test/Y03arguments.ztst15
3 files changed, 21 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 038fb91a1..72e668c7b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-04-05  Oliver Kiddle  <okiddle@yahoo.co.uk>
+
+	* 42575: Src/Zle/computil.c, Test/Y03arguments.ztst: fix to not
+	complete options in the argument to another option
+
 2018-04-05  Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
 
 	* 42577: Completion/Unix/Command/_strings: fix macOS support
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