diff options
Diffstat (limited to 'Completion')
-rw-r--r-- | Completion/Base/Completer/_complete | 2 | ||||
-rw-r--r-- | Completion/Base/Core/_description | 15 | ||||
-rw-r--r-- | Completion/Base/Core/_main_complete | 2 | ||||
-rw-r--r-- | Completion/Base/Core/_message | 13 | ||||
-rw-r--r-- | Completion/Base/Utility/_alternative | 4 | ||||
-rw-r--r-- | Completion/Base/Utility/_arguments | 2 | ||||
-rw-r--r-- | Completion/Base/Utility/_values | 2 | ||||
-rw-r--r-- | Completion/Unix/Command/_chown | 2 |
8 files changed, 34 insertions, 8 deletions
diff --git a/Completion/Base/Completer/_complete b/Completion/Base/Completer/_complete index 98d293175..16e0f5e9f 100644 --- a/Completion/Base/Completer/_complete +++ b/Completion/Base/Completer/_complete @@ -36,7 +36,7 @@ if [[ -n "$compcontext" ]]; then case "$action" in \ #) - _message "$descr";; + _message -e "$tag" "$descr";; \(\(*\)\)) eval ws\=\( "${action[3,-3]}" \) diff --git a/Completion/Base/Core/_description b/Completion/Base/Core/_description index 6b4cadfe8..30e6dfa9b 100644 --- a/Completion/Base/Core/_description +++ b/Completion/Base/Core/_description @@ -1,6 +1,6 @@ #autoload -local name gropt=-J format gname hidden hide match opts +local name gropt=-J format gname hidden hide match opts tag opts=() @@ -51,6 +51,8 @@ else _comp_ignore=() fi +tag="$1" + shift 2 if [[ -z "$1" && $# -eq 1 ]]; then format= @@ -72,4 +74,15 @@ else fi fi +if ! (( ${funcstack[2,-1][(I)_description]} )) && + zstyle -a ":completion:${curcontext}:$tag" fake match; then + + local descr + + descr=( "${(@M)match:#*[^\\]:*}" ) + + compadd "${(@P)name}" - "${(@)${(@)match:#*[^\\]:*}:s/\\:/:/}" + (( $#descr )) && _describe -t "$tag" '' descr "${(@P)name}" +fi + return 0 diff --git a/Completion/Base/Core/_main_complete b/Completion/Base/Core/_main_complete index 5960b2da7..f3ad720c9 100644 --- a/Completion/Base/Core/_main_complete +++ b/Completion/Base/Core/_main_complete @@ -268,7 +268,7 @@ if [[ $compstate[old_list] = keep || nm -gt 1 ]]; then fi fi fi -elif [[ nm -le 1 && -n "$_comp_mesg" ]]; then +elif [[ nm -lt 1 && -n "$_comp_mesg" ]]; then compstate[insert]='' compstate[list]='list force' elif [[ nm -eq 0 && -z "$_comp_mesg" && diff --git a/Completion/Base/Core/_message b/Completion/Base/Core/_message index cd08d5fb0..44512f648 100644 --- a/Completion/Base/Core/_message +++ b/Completion/Base/Core/_message @@ -2,6 +2,19 @@ local format raw +if [[ "$1" = -e ]]; then + local expl ret=1 + + _comp_mesg=yes + + _tags "$2" && while _next_label "$2" expl "$3"; do + compadd ${expl:/-X/-x} + ret=0 + done + + return ret +fi + _tags messages || return 1 if [[ "$1" = -r ]]; then diff --git a/Completion/Base/Utility/_alternative b/Completion/Base/Utility/_alternative index d6aef96b6..2f3e2dbc8 100644 --- a/Completion/Base/Utility/_alternative +++ b/Completion/Base/Utility/_alternative @@ -31,7 +31,7 @@ while _tags; do # An empty action means that we should just display a message. - mesgs=( "$mesgs[@]" "$descr") + mesgs=( "$mesgs[@]" "${def%%:*}:$descr") elif [[ "$action" = \(\(*\)\) ]]; then local ws @@ -76,7 +76,7 @@ while _tags; do done for descr in "$mesgs[@]"; do - _message "$descr" + _message -e "${descr%%:*}" "${desc#*:}" done return 1 diff --git a/Completion/Base/Utility/_arguments b/Completion/Base/Utility/_arguments index 0551afcf2..b4f3c599f 100644 --- a/Completion/Base/Utility/_arguments +++ b/Completion/Base/Utility/_arguments @@ -274,7 +274,7 @@ if (( $# )) && comparguments -i "$autod" "$singopt[@]" "$@"; then # An empty action means that we should just display a message. - _message "$descr" + _message -e "$subc" "$descr" mesg=yes tried=yes alwopt=${alwopt:-yes} diff --git a/Completion/Base/Utility/_values b/Completion/Base/Utility/_values index bb0337911..00249e05b 100644 --- a/Completion/Base/Utility/_values +++ b/Completion/Base/Utility/_values @@ -103,7 +103,7 @@ if compvalues -i "$@"; then # An empty action means that we should just display a message. - _message "$descr" + _message -e arguments "$descr" return 1 elif [[ "$action" = \(\(*\)\) ]]; then diff --git a/Completion/Unix/Command/_chown b/Completion/Unix/Command/_chown index 2e55209c5..599e09d14 100644 --- a/Completion/Unix/Command/_chown +++ b/Completion/Unix/Command/_chown @@ -5,7 +5,7 @@ local suf usr grp req expl line line=( "${(@)words[2,CURRENT-1]:#-*}" ) if [[ -prefix - ]]; then - _message option + _message -e options option elif [[ $#line -eq 0 ]]; then if [[ $service = chgrp ]] || compset -P '*[:.]'; then if (( EGID && $+commands[groups] )); then # except for root |