diff options
author | Oliver Kiddle <opk@users.sourceforge.net> | 2003-02-25 18:43:39 +0000 |
---|---|---|
committer | Oliver Kiddle <opk@users.sourceforge.net> | 2003-02-25 18:43:39 +0000 |
commit | ab1a0844f2756ecf377822f6bdddefbcec1a34b4 (patch) | |
tree | 7f88131f41e6f077efac73d0d80dd5adf660755e /Completion | |
parent | 0911160d0723230b18305076a6bff30402906183 (diff) | |
download | zsh-ab1a0844f2756ecf377822f6bdddefbcec1a34b4.tar.gz zsh-ab1a0844f2756ecf377822f6bdddefbcec1a34b4.tar.xz zsh-ab1a0844f2756ecf377822f6bdddefbcec1a34b4.zip |
18296: sync fake _all_labels and _next_label functions with changes to real ones
Diffstat (limited to 'Completion')
-rw-r--r-- | Completion/Base/Widget/_next_tags | 75 |
1 files changed, 38 insertions, 37 deletions
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 |