c6dbd9
From f92e6a9a7360b0485ebdaa006042337ffd9aa8df Mon Sep 17 00:00:00 2001
c6dbd9
From: Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
c6dbd9
Date: Fri, 6 Feb 2015 23:06:07 +0900
c6dbd9
Subject: [PATCH 1/2] 34456: lopts should be initialized as an array
c6dbd9
c6dbd9
otherwise an empty element remains in lopts, which causes
c6dbd9
a trouble when _arguments -- '*:' is called.
c6dbd9
c6dbd9
Upstream-commit: 2810317ae2f2f96d06add76c17510a90f2ea3f62
c6dbd9
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
c6dbd9
---
c6dbd9
 Completion/Base/Utility/_arguments | 2 +-
c6dbd9
 1 file changed, 1 insertion(+), 1 deletion(-)
c6dbd9
c6dbd9
diff --git a/Completion/Base/Utility/_arguments b/Completion/Base/Utility/_arguments
c6dbd9
index d70c442..1f35e8d 100644
c6dbd9
--- a/Completion/Base/Utility/_arguments
c6dbd9
+++ b/Completion/Base/Utility/_arguments
c6dbd9
@@ -26,7 +26,7 @@ if (( long )); then
c6dbd9
 
c6dbd9
   if (( ! ${(P)+name} )); then
c6dbd9
     local iopts sopts pattern tmpo dir cur cache
c6dbd9
-    typeset -U lopts
c6dbd9
+    typeset -Ua lopts
c6dbd9
 
c6dbd9
     cache=()
c6dbd9
 
c6dbd9
-- 
c6dbd9
2.5.5
c6dbd9
c6dbd9
c6dbd9
From 08801bde8876d8a671165b1856ad99aec5dd6564 Mon Sep 17 00:00:00 2001
c6dbd9
From: Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
c6dbd9
Date: Wed, 30 Sep 2015 23:56:14 +0900
c6dbd9
Subject: [PATCH 2/2] 36697: handle options of _arguments correctly
c6dbd9
c6dbd9
Upstream-commit: 756526eef3e064c3ffb023ae5e5e6df42e6e9162
c6dbd9
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
c6dbd9
---
c6dbd9
 Completion/Base/Utility/_arguments | 45 +++++++++++++++++++-------------------
c6dbd9
 1 file changed, 23 insertions(+), 22 deletions(-)
c6dbd9
c6dbd9
diff --git a/Completion/Base/Utility/_arguments b/Completion/Base/Utility/_arguments
c6dbd9
index 1f35e8d..87fb20e 100644
c6dbd9
--- a/Completion/Base/Utility/_arguments
c6dbd9
+++ b/Completion/Base/Utility/_arguments
c6dbd9
@@ -8,15 +8,33 @@ local oldcontext="$curcontext" hasopts rawret optarg singopt alwopt
c6dbd9
 local setnormarg start rest
c6dbd9
 local -a match mbegin mend
c6dbd9
 
c6dbd9
+subopts=()
c6dbd9
+singopt=()
c6dbd9
+while [[ "$1" = -([AMO]*|[CRSWnsw]) ]]; do
c6dbd9
+  case "$1" in
c6dbd9
+  -C)  usecc=yes; shift ;;
c6dbd9
+  -O)  subopts=( "${(@P)2}" ); shift 2 ;;
c6dbd9
+  -O*) subopts=( "${(@P)${1[3,-1]}}" ); shift ;;
c6dbd9
+  -R)  rawret=yes; shift;;
c6dbd9
+  -n)  setnormarg=yes; NORMARG=-1; shift;;
c6dbd9
+  -w)  optarg=yes; shift;;
c6dbd9
+  -W)  alwopt=arg; shift;;
c6dbd9
+  -[Ss])  singopt+=( $1 ); shift;;
c6dbd9
+  -[AM])  singopt+=( $1 $2 ); shift 2 ;;
c6dbd9
+  -[AM]*) singopt+=( $1 ); shift ;;
c6dbd9
+  esac
c6dbd9
+done
c6dbd9
+
c6dbd9
+[[ $1 = ':' ]] && shift
c6dbd9
+singopt+=( ':' )  # always end with ':' to indicate the end of options
c6dbd9
+
c6dbd9
+[[ "$PREFIX" = [-+] ]] && alwopt=arg
c6dbd9
+
c6dbd9
 long=$argv[(I)--]
c6dbd9
 if (( long )); then
c6dbd9
   local name tmp tmpargv
c6dbd9
 
c6dbd9
-  if [[ long -eq 1 ]]; then
c6dbd9
-    tmpargv=()
c6dbd9
-  else
c6dbd9
-    tmpargv=( "${(@)argv[1,long-1]}" )
c6dbd9
-  fi
c6dbd9
+  tmpargv=( "${(@)argv[1,long-1]}" )  # optspec's before --, if any
c6dbd9
 
c6dbd9
   name=${~words[1]}
c6dbd9
   [[ "$name" = [^/]*/* ]] && name="$PWD/$name"
c6dbd9
@@ -290,23 +308,6 @@ if (( long )); then
c6dbd9
   set -- "$tmpargv[@]" "${(@P)name}"
c6dbd9
 fi
c6dbd9
 
c6dbd9
-subopts=()
c6dbd9
-singopt=()
c6dbd9
-while [[ "$1" = -(O*|[CRWnsw]) ]]; do
c6dbd9
-  case "$1" in
c6dbd9
-  -C)  usecc=yes; shift ;;
c6dbd9
-  -O)  subopts=( "${(@P)2}" ); shift 2 ;;
c6dbd9
-  -O*) subopts=( "${(@P)${1[3,-1]}}" ); shift ;;
c6dbd9
-  -R)  rawret=yes; shift;;
c6dbd9
-  -n)  setnormarg=yes; NORMARG=-1; shift;;
c6dbd9
-  -w)  optarg=yes; shift;;
c6dbd9
-  -s)  singopt=(-s); shift;;
c6dbd9
-  -W)  alwopt=arg; shift;;
c6dbd9
-  esac
c6dbd9
-done
c6dbd9
-
c6dbd9
-[[ "$PREFIX" = [-+] ]] && alwopt=arg
c6dbd9
-
c6dbd9
 zstyle -s ":completion:${curcontext}:options" auto-description autod
c6dbd9
 
c6dbd9
 if (( $# )) && comparguments -i "$autod" "$singopt[@]" "$@"; then
c6dbd9
-- 
c6dbd9
2.5.5
c6dbd9