From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8320 invoked from network); 25 Feb 2003 18:38:30 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 25 Feb 2003 18:38:30 -0000 Received: (qmail 15689 invoked by alias); 25 Feb 2003 18:38:21 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 18296 Received: (qmail 15680 invoked from network); 25 Feb 2003 18:38:21 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 25 Feb 2003 18:38:21 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [193.109.254.147] by sunsite.dk (MessageWall 1.0.8) with SMTP; 25 Feb 2003 18:38:18 -0000 X-VirusChecked: Checked X-Env-Sender: kiddleo@logica.com X-Msg-Ref: server-5.tower-27.messagelabs.com!1046198298!4148 Received: (qmail 29416 invoked from network); 25 Feb 2003 18:38:18 -0000 Received: from iris.logica.co.uk (158.234.9.163) by server-5.tower-27.messagelabs.com with SMTP; 25 Feb 2003 18:38:18 -0000 Received: from finches.logica.co.uk ([158.234.142.11]) by iris.logica.co.uk (8.9.3/8.9.3/Debian 8.9.3-21) with ESMTP id SAA15020 for ; Tue, 25 Feb 2003 18:38:16 GMT X-Authentication-Warning: iris.logica.co.uk: Host [158.234.142.11] claimed to be finches.logica.co.uk Received: from finches.logica.co.uk (localhost [127.0.0.1]) by finches.logica.co.uk (8.11.6/8.11.6/SuSE Linux 0.5) with ESMTP id h1PIfub03904 for ; Tue, 25 Feb 2003 19:41:56 +0100 From: Oliver Kiddle To: Zsh workers Subject: PATCH: more _next_tags problems Date: Tue, 25 Feb 2003 19:41:56 +0100 Message-ID: <3902.1046198516@finches.logica.co.uk> Sender: kiddleo@logica.com _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.