From b0226d3cc8393bb4dd57d9e2e8f04ef885c43ab9 Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Fri, 24 Mar 2000 12:37:56 +0000 Subject: zsh-workers/10231 --- Completion/Commands/_next_tags | 45 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 4 deletions(-) (limited to 'Completion/Commands') diff --git a/Completion/Commands/_next_tags b/Completion/Commands/_next_tags index 028ba4d61..6d3389ff1 100644 --- a/Completion/Commands/_next_tags +++ b/Completion/Commands/_next_tags @@ -46,7 +46,7 @@ _next_tags_pre() { # Helper function for sorting tags. Most of this is copied from _tags. _next_tags_sort() { - local order tags tag nodef + local order tags tag nodef tmp tmp2 if ! zstyle -a ":completion:${curcontext}:" tag-order order; then if (( $+_comp_default_tags )); then @@ -69,12 +69,49 @@ _next_tags_sort() { case $tag in -) nodef=yes;; *\(\)) "${${tag%%[ ]#\(\)}##[ ]#}" "$@";; - \!*) comptry "${(@)argv:#(${(j:|:)~${=tag[2,-1]}})}";; - ?*) comptry ${=tag};; + \!*) comptry "${(@)argv:#(${(j:|:)~${=~tag[2,-1]}})}";; + ?*) tmp=( ${${(s: :)${tag//\\\\ /$'\0'}}//$'\0'/ } ) tmp2=() tmp3=() + for tag in "$tmp[@]"; do + if [[ "$tag" = *:* ]]; then + tmp2=( "$tmp2[@]" "${(@M)^argv:#${~tag%%:*}}:${tag#*:}" ) + else + for atag in "${(@M)argv:#${~tag}}"; do + if zstyle -a ":completion:${curcontext}:${atag}" tag-aliases als; then + tmp3=( "$tmp3[@]" "$als[@]" ) + tmp=( "${(@)tmp:#${atag}}" ) + else + tmp2=( "$tmp2[@]" "$atag" ) + fi + done + fi + done + + comptry "${(@)tmp2:#(${(j:|:)~${(q)tmp%%:*}})}" "$tmp3[@]" "$tmp[@]" + ;; esac done - [[ -z "$nodef" ]] && comptry "$@" + if [[ -z "$nodef" ]]; then + if (( $+_comp_default_tags )); then + for tag in "$_comp_default_tags[@]"; do + if zstyle -a ":completion:${curcontext}:${tag}" tag-aliases als; then + comptry "$als[@]" + else + comptry "$tag" + fi + done + else + tmp2=() + for tag; do + if zstyle -a ":completion:${curcontext}:${tag}" tag-aliases als; then + tmp2=( "$tmp2[@]" "$als[@]" ) + else + tmp2=( "$tmp2[@]" "$tag" ) + fi + done + comptry "$tmp2[@]" + fi + fi } [[ -o kshautoload ]] || _next_tags "$@" -- cgit 1.4.1