about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--Completion/Base/Widget/_next_tags75
2 files changed, 41 insertions, 37 deletions
diff --git a/ChangeLog b/ChangeLog
index da5117650..64a6ea283 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2003-02-25  Oliver Kiddle  <opk@zsh.org>
 
+	* 18296: Completion/Base/Widget/_next_tags: fake _all_labels and
+	_next_label functions were out of sync with changes to the real ones
+
 	* unposted: Completion/Zsh/Context/_value, Doc/Zsh/compsys.yo:
 	fix out of date documentation and move description of special
 	contexts from _complete's to #compdef's description
diff --git a/Completion/Base/Widget/_next_tags b/Completion/Base/Widget/_next_tags
index 0620a1f99..eaf7e3ace 100644
--- a/Completion/Base/Widget/_next_tags
+++ b/Completion/Base/Widget/_next_tags
@@ -10,64 +10,65 @@ _next_tags() {
   unfunction _all_labels _next_label
 
   _all_labels() {
-    local gopt=-J len tmp pre suf ret=1 descr spec
+    local __gopt __len __tmp __pre __suf __ret=1 __descr __spec __prev
 
-    if [[ "$1" = -([12]|)[VJ] ]]; then
-      gopt="$1"
+    if [[ "$1" = - ]]; then
+      __prev=-
       shift
     fi
 
-    tmp=${argv[(ib:4:)-]}
-    len=$#
-    if [[ tmp -lt len ]]; then
-      pre=$(( tmp-1 ))
-      suf=$tmp
-    elif [[ tmp -eq $# ]]; then
-      pre=-2
-      suf=$(( len+1 ))
+    __gopt=()
+    zparseopts -D -a __gopt 1 2 V J x
+
+    __tmp=${argv[(ib:4:)-]}
+    __len=$#
+    if [[ __tmp -lt __len ]]; then
+      __pre=$(( __tmp-1 ))
+      __suf=$__tmp
+    elif [[ __tmp -eq $# ]]; then
+      __pre=-2
+      __suf=$(( __len+1 ))
     else
-      pre=4
-      suf=5
+      __pre=4
+      __suf=5
     fi
 
-    while comptags -A "$1" curtag spec; do
-      [[ "$_next_tags_not" = *\ ${spec}\ * ]] && continue
-      _comp_tags="$_comp_tags $spec "
-      if [[ "$curtag" = *:* ]]; then
-        zformat -f descr "${curtag#*:}" "d:$3"
-        _description "$gopt" "${curtag%:*}" "$2" "$descr"
+    while comptags "-A$__prev" "$1" curtag __spec; do
+      [[ "$_next_tags_not" = *\ ${__spec}\ * ]] && continue
+      _comp_tags="$_comp_tags $__spec "
+      if [[ "$curtag" = *[^\\]:* ]]; then
+        zformat -f __descr "${curtag#*:}" "d:$3"
+        _description "$__gopt[@]" "${curtag%:*}" "$2" "$__descr"
         curtag="${curtag%:*}"
 
-        "$4" "${(P@)2}" "${(@)argv[5,-1]}"
+        "$4" "${(P@)2}" "${(@)argv[5,-1]}" && __ret=0
       else
-        _description "$gopt" "$curtag" "$2" "$3"
+        _description "$__gopt[@]" "$curtag" "$2" "$3"
 
-        "${(@)argv[4,pre]}" "${(P@)2}" "${(@)argv[suf,-1]}" && ret=0
+        "${(@)argv[4,__pre]}" "${(P@)2}" "${(@)argv[__suf,-1]}" && __ret=0
       fi
     done
 
-    return ret
+    return __ret
   }
 
   _next_label() {
-    local gopt=-J descr spec
+    local __gopt __descr __spec
 
-    if [[ "$1" = -([12]|)[VJ] ]]; then
-      gopt="$1"
-      shift
-    fi
+    __gopt=()
+    zparseopts -D -a __gopt 1 2 V J x
 
-    if comptags -A "$1" curtag spec; then
-      [[ "$_next_tags_not" = *\ ${spec}\ * ]] && continue
-      _comp_tags="$_comp_tags $spec "
-      if [[ "$curtag" = *:* ]]; then
-        zformat -f descr "${curtag#*:}" "d:$3"
-        _description "$gopt" "${curtag%:*}" "$2" "$descr"
+    if comptags -A "$1" curtag __spec; then
+      [[ "$_next_tags_not" = *\ ${__spec}\ * ]] && continue
+      _comp_tags="$_comp_tags $__spec "
+      if [[ "$curtag" = *[^\\]:* ]]; then
+        zformat -f __descr "${curtag#*:}" "d:$3"
+        _description "$__gopt[@]" "${curtag%:*}" "$2" "$__descr"
         curtag="${curtag%:*}"
-	set -A "$2" "${(P@)2}" "${(@)argv[4,-1]}"
+	set -A $2 "${(P@)2}" "${(@)argv[4,-1]}"
       else
-        _description "$gopt" "$curtag" "$2" "$3"
-	set -A "$2" "${(@)argv[4,-1]}" "${(P@)2}"
+        _description "$__gopt[@]" "$curtag" "$2" "$3"
+	set -A $2 "${(@)argv[4,-1]}" "${(P@)2}"
       fi
 
       return 0