From 0e20ad9aa0989caf2a488c8590f22beeba24c9b0 Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Tue, 14 Sep 1999 08:34:27 +0000 Subject: zsh-workers/7819 --- Completion/Base/_arguments | 12 ++++++++++-- Doc/Zsh/compsys.yo | 5 ++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Completion/Base/_arguments b/Completion/Base/_arguments index 808bfc2ab..1e1787b19 100644 --- a/Completion/Base/_arguments +++ b/Completion/Base/_arguments @@ -8,7 +8,7 @@ setopt localoptions extendedglob local args rest ws cur nth def nm expl descr action opt arg tmp xor local single uns ret=1 aret soptseq soptseq1 sopts prefix _line odescr local beg optbeg argbeg nargbeg inopt inrest fromrest cmd="$words[1]" -local matched curopt noargs +local matched curopt noargs i # Associative arrays used to collect information about the options. @@ -433,7 +433,9 @@ while [[ cur -gt 0 ]]; do if (( $+opts[$tmp] )); then def="$opts[$tmp]" curopt="$tmp" - _options[$curopt]='' + for i in ${(s::)ws[1][2,-1]}; do + _options[${ws[1][1]}$i]='' + done optbeg="$beg" argbeg="$beg" inopt=yes @@ -646,6 +648,9 @@ if [[ -z "$def" || "$def" = :* ]]; then def="$dopts[$tmp[1]]" opt='' uns="${prefix[2,-1]%%${tmp[1][2]}*}${tmp[1][2]}" + for i in ${(s::)prefix[2,-1]%%${tmp[1][2]}*} ${tmp[1][2]}; do + _options[${prefix[1]}$i]='' + done break elif compset -P "$tmp[1]"; then @@ -667,6 +672,9 @@ if [[ -z "$def" || "$def" = :* ]]; then def="$odopts[$tmp[1]]" opt='' uns="${prefix[2,-1]%%${tmp[1][2]}*}${tmp[1][2]}" + for i in ${(s::)prefix[2,-1]%%${tmp[1][2]}*} ${tmp[1][2]}; do + _options[${prefix[1]}$i]='' + done break elif compset -P "$tmp[1]"; then def="$odopts[$tmp[1]]" diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo index 6ce13fc35..8025c7ad2 100644 --- a/Doc/Zsh/compsys.yo +++ b/Doc/Zsh/compsys.yo @@ -819,7 +819,10 @@ starts with a space, this list of words will be invoked unchanged, otherwise it will be invoked with some extra string placed after the first word which can be given as arguments to the tt(compadd) and tt(compgen) builtins and which make sure that the var(message) given -in the description will be shown above the matches. +in the description will be shown above the matches. These arguments +are taken from the array parameter tt(expl) which will be set up +before executing the var(action) and hence may be used in it (normally +in an expansion like `tt($expl[@])'). In places where no sensible matches can be generated, the action should consist of only a space. This will make the var(message) be -- cgit 1.4.1