1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-11-19 13:33:52 +01:00

18296: sync fake _all_labels and _next_label functions with changes to real ones

This commit is contained in:
Oliver Kiddle 2003-02-25 18:43:39 +00:00
parent 0911160d07
commit ab1a0844f2
2 changed files with 41 additions and 37 deletions

@ -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

@ -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