about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2017-11-04 00:57:48 +0100
committerOliver Kiddle <opk@zsh.org>2017-11-04 00:57:48 +0100
commit1bfcff129d27314d2b5b08117a61e67912fafc2d (patch)
tree0fca417416df265a14c6e4743dc9aa4fe9dcd79a
parent5498e0cb9e88729162015934dde8318038afee88 (diff)
downloadzsh-1bfcff129d27314d2b5b08117a61e67912fafc2d.tar.gz
zsh-1bfcff129d27314d2b5b08117a61e67912fafc2d.tar.xz
zsh-1bfcff129d27314d2b5b08117a61e67912fafc2d.zip
41983: fix exclusion of long options with (-) on a normal argument
-rw-r--r--ChangeLog5
-rw-r--r--Src/Zle/computil.c2
-rw-r--r--Test/Y03arguments.ztst8
3 files changed, 13 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 4ce3987a2..f27845225 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2017-11-04  Oliver Kiddle  <opk@zsh.org>
+
+	* 41983: Src/Zle/computil.c, Test/Y03arguments.ztst:
+	fix exclusion of long options with (-) on a normal argument
+
 2017-11-03  Daniel Shahaf  <d.s@daniel.shahaf.name>
 
 	* 41969: Completion/Unix/Command/_sort: Clarify option
diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c
index 70cea9f27..71d61563b 100644
--- a/Src/Zle/computil.c
+++ b/Src/Zle/computil.c
@@ -2080,7 +2080,7 @@ ca_parse_line(Cadef d, Cadef all, int multi, int first)
         remnulargs(line);
         untokenize(line);
 
-	ca_inactive(d, argxor, cur, 0);
+	ca_inactive(d, argxor, cur - 1, 0);
 	if ((d->flags & CDF_SEP) && cur != compcurrent && !strcmp(line, "--")) {
 	    ca_inactive(d, NULL, cur, 1);
 	    continue;
diff --git a/Test/Y03arguments.ztst b/Test/Y03arguments.ztst
index de495ee6c..7cbadfe8c 100644
--- a/Test/Y03arguments.ztst
+++ b/Test/Y03arguments.ztst
@@ -485,12 +485,18 @@
 >NO:{-c}
 >NO:{-g}
 
- tst_arguments '(-)-h' -a -b -c
+ tst_arguments '(-)-h' -a -b -c --long +p
  comptest $'tst -h -\t'
 0:exclude all other options
 >line: {tst -h -}{}
 >MESSAGE:{no arguments}
 
+ tst_arguments --args -b -c +p '(-)1:normal'
+ comptest $'tst arg -\t'
+0:exclude all options from a normal argument
+>line: {tst arg -}{}
+>MESSAGE:{no more arguments}
+
  tst_arguments -a '(-a)-b'
  comptest $'tst - -b\C-b\C-b\C-b\t'
 0:exclusion only applies to later words