zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: Zsh workers <zsh-workers@sunsite.dk>
Subject: PATCH: more _next_tags problems
Date: Tue, 25 Feb 2003 19:41:56 +0100	[thread overview]
Message-ID: <3902.1046198516@finches.logica.co.uk> (raw)

_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.


                 reply	other threads:[~2003-02-25 18:38 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3902.1046198516@finches.logica.co.uk \
    --to=okiddle@yahoo.co.uk \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).