From 726e1f5545e35b2cc589d1e43202ae6c04fbffca Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Thu, 9 Dec 1999 10:39:37 +0000 Subject: zsh-workers/8965 --- Completion/Core/_description | 6 ++---- Completion/Core/_files | 12 ++++++------ Completion/Core/_main_complete | 5 ++--- Completion/Core/_multi_parts | 16 ++++++++-------- Completion/Core/_path_files | 19 +++++++++++-------- Completion/Core/_sep_parts | 12 ++++++------ 6 files changed, 35 insertions(+), 35 deletions(-) (limited to 'Completion') diff --git a/Completion/Core/_description b/Completion/Core/_description index 9f315f9b1..3bf15d320 100644 --- a/Completion/Core/_description +++ b/Completion/Core/_description @@ -5,12 +5,9 @@ local name gropt format gname hidden hide gropt=(-J) hide=() -if [[ "$1" = -[VJ] ]]; then +if [[ "$1" = -([12]|)[VJ] ]]; then gropt=("$1") shift -elif [[ "$1" = -[VJ] ]]; then - gropt=("-${1[3,-1]}" "${1[1,2]}") - shift fi _lastdescr=( "$_lastdescr[@]" "$3" ) @@ -20,6 +17,7 @@ _setup "$1" name="$2" _style -s "$1" format format || _style -s descriptions format format + _style -s "$1" hidden hidden if [[ "$hidden" = (all|yes|true|1|on) ]]; then [[ "$hidden" = all ]] && format='' diff --git a/Completion/Core/_files b/Completion/Core/_files index 32d78dba1..a92771f80 100644 --- a/Completion/Core/_files +++ b/Completion/Core/_files @@ -4,13 +4,13 @@ local opts opt type=file group opts=() group=() -while getopts "P:S:qr:R:W:F:J:V:X:f/g:M:" opt; do +while getopts "P:S:qr:R:W:F:J:V:X:f/g:M:12n" opt; do case "$opt" in - /) [[ "$type" = file ]] && type=dir ;; - g) [[ "$type" = (file|dir) ]] && type="$OPTARG" ;; - q) opts=("$opts[@]" -q ) ;; - [JV]) group=( "-$opt" "$OPTARG") ;; - [^f]) opts=("$opts[@]" "-$opt" "$OPTARG") ;; + /) [[ "$type" = file ]] && type=dir ;; + g) [[ "$type" = (file|dir) ]] && type="$OPTARG" ;; + [qn12]) opts=("$opts[@]" "-$opt" ) ;; + [JV]) group=( "-$opt" "$OPTARG") ;; + [^f]) opts=("$opts[@]" "-$opt" "$OPTARG") ;; esac done diff --git a/Completion/Core/_main_complete b/Completion/Core/_main_complete index 3542876f5..2bacad88b 100644 --- a/Completion/Core/_main_complete +++ b/Completion/Core/_main_complete @@ -136,11 +136,10 @@ if [[ "$compstate[insert]" = *menu ]]; then fi fi -_style -s warnings format format - if [[ compstate[nmatches] -eq 0 && compstate[matcher] -eq compstate[total_matchers] && - -n "$format" && $#_lastdescr -ne 0 ]]; then + $#_lastdescr -ne 0 ]] && + _style -s warnings format format; then local str compstate[list]='list force' diff --git a/Completion/Core/_multi_parts b/Completion/Core/_multi_parts index e842db754..056f44bdd 100644 --- a/Completion/Core/_multi_parts +++ b/Completion/Core/_multi_parts @@ -17,15 +17,15 @@ group=() expl=() opts=() sopts=() -while getopts "J:V:X:P:S:r:R:qM:" opt; do +while getopts "J:V:X:P:S:r:R:qM:12n" opt; do case "$opt" in - [JV]) group=("-$opt" "$OPTARG");; - X) expl=(-X "$OPTARG");; - P) opts=( "$opts[@]" -P "$OPTARG") - sopts=( "$sopts[@]" -P "$OPTARG");; - [SrR]) sopts=( "$sopts[@]" -P "$OPTARG");; - q) sopts=( "$sopts[@]" -q);; - M) match="$OPTARG";; + [JV]) group=("-$opt" "$OPTARG");; + X) expl=(-X "$OPTARG");; + P) opts=( "$opts[@]" -P "$OPTARG") + sopts=( "$sopts[@]" -P "$OPTARG");; + [SrR]) sopts=( "$sopts[@]" -P "$OPTARG");; + [q12n]) sopts=( "$sopts[@]" "-$opt");; + M) match="$OPTARG";; esac done shift OPTIND-1 diff --git a/Completion/Core/_path_files b/Completion/Core/_path_files index 79b1473c4..e5135a422 100644 --- a/Completion/Core/_path_files +++ b/Completion/Core/_path_files @@ -6,7 +6,7 @@ local linepath realpath donepath prepath testpath exppath local tmp1 tmp2 tmp3 tmp4 i orig pre suf tpre tsuf opre osuf cpre local pats haspats=no ignore group expl addpfx addsfx remsfx -local nm=$compstate[nmatches] menu match matcher +local nm=$compstate[nmatches] menu match matcher mopts typeset -U prepaths exppaths @@ -24,11 +24,14 @@ addsfx=() remsfx=() expl=() matcher=() +mopts=() # Get the options. -while getopts "P:S:qr:R:W:F:J:V:X:f/g:M:" opt; do +while getopts "P:S:qr:R:W:F:J:V:X:f/g:M:12n" opt; do case "$opt" in + [12n]) mopts=( "$mopts[@]" "-$opt" ) + ;; P) addpfx=(-P "$OPTARG") ;; S) addsfx=(-S "$OPTARG") @@ -347,13 +350,13 @@ for prepath in "$prepaths[@]"; do if [[ -n $menu ]] || ! _style paths expand '*suffix*'; then _style paths cursor && compstate[to_end]='' if [[ "$tmp3" = */* ]]; then - compadd -Qf -p "$linepath$tmp4" -s "/${tmp3#*/}" \ + compadd -Qf "$mopts[@]" -p "$linepath$tmp4" -s "/${tmp3#*/}" \ -W "$prepath$realpath$testpath" "$ignore[@]" \ "$addpfx[@]" "$addsfx[@]" "$remsfx[@]" \ -M "r:|/=* r:|=* $match" "$group[@]" "$expl[@]" \ - "${(@)tmp1%%/*}" else - compadd -Qf -p "$linepath$tmp4" \ + compadd -Qf "$mopts[@]" -p "$linepath$tmp4" \ -W "$prepath$realpath$testpath" "$ignore[@]" \ "$addpfx[@]" "$addsfx[@]" "$remsfx[@]" \ -M "r:|/=* r:|=* $match" "$group[@]" "$expl[@]" \ @@ -362,14 +365,14 @@ for prepath in "$prepaths[@]"; do else if [[ "$tmp3" = */* ]]; then for i in "$tmp1[@]"; do - compadd -Qf -p "$linepath$tmp4" -s "/${i#*/}" \ + compadd -Qf "$mopts[@]" -p "$linepath$tmp4" -s "/${i#*/}" \ -W "$prepath$realpath$testpath" "$ignore[@]" \ "$addpfx[@]" "$addsfx[@]" "$remsfx[@]" \ -M "r:|/=* r:|=* $match" "$group[@]" "$expl[@]" \ - "${i%%/*}" done else - compadd -Qf -p "$linepath$tmp4" \ + compadd -Qf "$mopts[@]" -p "$linepath$tmp4" \ -W "$prepath$realpath$testpath" "$ignore[@]" \ "$addpfx[@]" "$addsfx[@]" "$remsfx[@]" \ -M "r:|/=* r:|=* $match" "$group[@]" "$expl[@]" \ @@ -419,7 +422,7 @@ for prepath in "$prepaths[@]"; do fi tmp4="$testpath" compquote tmp4 tmp1 - compadd -Qf -p "$linepath$tmp4" \ + compadd -Qf "$mopts[@]" -p "$linepath$tmp4" \ -W "$prepath$realpath$testpath" "$ignore[@]" \ "$addpfx[@]" "$addsfx[@]" "$remsfx[@]" \ -M "r:|/=* r:|=* $match" "$group[@]" "$expl[@]" \ @@ -437,7 +440,7 @@ if _style paths expand '*prefix*' && [[ $#exppaths -gt 0 && nm -eq compstate[nmatches] ]]; then PREFIX="${opre}" SUFFIX="${osuf}" - compadd -Q -S '' "$group[@]" "$expl[@]" \ + compadd -Q "$mopts[@]" -S '' "$group[@]" "$expl[@]" \ -M "r:|/=* r:|=* $match" -p "$linepath" - "$exppaths[@]" fi diff --git a/Completion/Core/_sep_parts b/Completion/Core/_sep_parts index c65a944e3..ca97113b1 100644 --- a/Completion/Core/_sep_parts +++ b/Completion/Core/_sep_parts @@ -25,13 +25,13 @@ local matchflags opt group expl nm=$compstate[nmatches] opre osuf opts match group=() expl=() opts=() -while getopts "J:V:X:P:S:r:R:qM:" opt; do +while getopts "J:V:X:P:S:r:R:qM:12n" opt; do case "$opt" in - [JV]) group=("-$opt" "$OPTARG");; - X) expl=(-X "$OPTARG");; - q) opts=( "$opts[@]" -q );; - M) match="$OPTARG";; - *) opts=( "$opts[@]" "-$opt" "$OPTARG" );; + [JV]) group=("-$opt" "$OPTARG");; + X) expl=(-X "$OPTARG");; + [q12n]) opts=( "$opts[@]" "-$opt" );; + M) match="$OPTARG";; + *) opts=( "$opts[@]" "-$opt" "$OPTARG" );; esac done shift OPTIND-1 -- cgit 1.4.1