zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: more _next_tags problems
@ 2003-02-25 18:41 Oliver Kiddle
  0 siblings, 0 replies; only message in thread
From: Oliver Kiddle @ 2003-02-25 18:41 UTC (permalink / raw)
  To: Zsh workers

_next_tags works by redefining _all_labels and _next_labels to slightly
modified ones which track the tag labels which are completed. These
have not been kept in sync with changes to the real _all_labels and
_next_labels for changes since 10632 and 11525 respectively. This patch
brings it up-to-date. It fixes a number of problems I was getting with
_next_tags though note that it does nothing about the two bugs Peter
recently found.

Oliver

Index: Completion/Base/Widget/_next_tags
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/Widget/_next_tags,v
retrieving revision 1.2
diff -u -r1.2 _next_tags
--- Completion/Base/Widget/_next_tags	29 May 2001 11:59:51 -0000	1.2
+++ Completion/Base/Widget/_next_tags	25 Feb 2003 18:31:08 -0000
@@ -10,64 +10,65 @@
   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

This e-mail and any attachment is for authorised use by the intended recipient(s) only.  It may contain proprietary material, confidential information and/or be subject to legal privilege.  It should not be copied, disclosed to, retained or used by, any other party.  If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender.  Thank you.


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

only message in thread, other threads:[~2003-02-25 18:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-25 18:41 PATCH: more _next_tags problems 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).