From a62f994ef941ca1910486fcf7cbaf0ad7a264f8e Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Fri, 27 Aug 1999 07:09:33 +0000 Subject: zsh-workers:7512 --- Completion/Base/_arguments | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/Completion/Base/_arguments b/Completion/Base/_arguments index eb6ec51bc..60b07b2e4 100644 --- a/Completion/Base/_arguments +++ b/Completion/Base/_arguments @@ -7,7 +7,7 @@ setopt localoptions extendedglob local long args rest ws cur nth def nm expl descr action opt arg tmp local single uns ret=1 soptseq soptseq1 sopts prefix line -local beg optbeg argbeg nargbeg inopt +local beg optbeg argbeg nargbeg inopt fromrest # Associative arrays used to collect information about the options. @@ -226,11 +226,7 @@ while [[ cur -gt 0 ]]; do def="$opts[$ws[1]]" optbeg="$beg" argbeg="$beg" - if [[ -n "$def" ]]; then - inopt=yes - else - inopt='' - fi + inopt=yes [[ -n "$oneshot[$ws[1]]" ]] && unset "opts[$ws[1]]" else uns='' @@ -240,11 +236,7 @@ while [[ cur -gt 0 ]]; do def="$opts[$tmp]" optbeg="$beg" argbeg="$beg" - if [[ -n "$def" ]]; then - inopt=yes - else - inopt='' - fi + inopt=yes uns="${ws[1][2,-1]}" opt='' fi @@ -285,13 +277,12 @@ while [[ cur -gt 0 ]]; do def="$dopts[$tmp[1]]" optbeg="$beg" argbeg="$beg" + inopt=yes [[ -n "$oneshot[$tmp[1]]" ]] && unset "dopts[$tmp[1]]" if [[ "$def" = [^*]*[^\\]:*[^\\]:* ]]; then def="${def#?*[^\\]:*[^\\]:}" - inopt=yes else def='' - inopt='' fi fi fi @@ -314,6 +305,7 @@ while [[ cur -gt 0 ]]; do def="$odopts[$tmp[1]]" optbeg="$beg" argbeg="$beg" + inopt=yes [[ -n "$oneshot[$tmp[1]]" ]] && unset "odopts[$tmp[1]]" # For options whose first argument *may* come after the @@ -331,11 +323,6 @@ while [[ cur -gt 0 ]]; do def='' fi fi - if [[ -n "$def" ]]; then - inopt=yes - else - inopt='' - fi fi fi @@ -371,7 +358,7 @@ while [[ cur -gt 0 ]]; do (( beg++ )) done -[[ -n "$inopt" ]] && nargbeg="$beg" +[[ -n "$inopt" ]] && nargbeg=$(( beg - 1 )) # Now generate the matches. @@ -403,6 +390,7 @@ else def="$rest" optbeg="$nargbeg" argbeg="$nargbeg" + fromrest=yes fi fi @@ -466,7 +454,8 @@ else (( $#tmp )) && unset "$tmp[@]" fi - if [[ -n "$opt" && "$def" != \** ]]; then + if [[ -n "$opt" && ( "$def" != \** || + ( -n "$fromrest" && CURRENT -eq argbeg+1 ) ) ]]; then # We aren't in an argument directly after a option name, so # all option names are possible matches. -- cgit 1.4.1