From 5a774bf3cb4fa2d7a3eaa0df6013fc1150bdf944 Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Fri, 7 Jan 2000 14:40:09 +0000 Subject: zsh-workers/9263 --- Completion/Core/_path_files | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'Completion/Core/_path_files') diff --git a/Completion/Core/_path_files b/Completion/Core/_path_files index 4445ed3b4..51222bd9c 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 eorig pre suf tpre tsuf opre osuf cpre local pats haspats=no ignore group expl addpfx addsfx remsfx -local nm=$compstate[nmatches] menu match matcher mopts atmp sort +local nm=$compstate[nmatches] menu mspec matcher mopts atmp sort match typeset -U prepaths exppaths @@ -76,21 +76,21 @@ while getopts "P:S:qr:R:W:F:J:V:X:f/g:M:12n" opt; do pats=("$pats[@]" ${=OPTARG}) haspats=yes ;; - M) match="$OPTARG" + M) mspec="$OPTARG" matcher=(-M "$OPTARG") ;; esac done if (( ! ( $#group + $#expl ) )); then - if [[ "$sopt" = -/ ]]; then + if [[ -z "$gopt" && "$sopt" = -/ ]]; then _description directories expl directory else _description files expl file fi tmp1=$expl[(I)-M] if (( tmp1 )); then - match="$match $expl[1+tmp1]" + mspec="$mspec $expl[1+tmp1]" if (( $#matcher )); then matcher[2]="$matcher[2] $expl[1+tmp1]" else @@ -132,10 +132,10 @@ if zstyle -s ":completion${curcontext}:files" sort tmp1; then tmp2=() for tmp1 in "$pats[@]"; do - if [[ "$tmp1" = ?*\(\([^\|~]##\)\) ]]; then - tmp2=( "$tmp2[@]" "${tmp1[1,-3]}${sort}))" ) - elif [[ "$tmp1" = ?*\([^\|~]##\) ]]; then - tmp2=( "$tmp2[@]" "${tmp1[1,-2]}${sort})" ) + if [[ "$tmp1" = (#b)(?*)(\(\([^\|~]##\)\)) ]]; then + tmp2=( "$tmp2[@]" "${match[1]}((${sort}${match[2][3,-1]}" ) + elif [[ "$tmp1" = (#b)(?*)(\([^\|~]##\)) ]]; then + tmp2=( "$tmp2[@]" "${match[1]}(${sort}${match[2][2,-1]}" ) else tmp2=( "$tmp2[@]" "${tmp1}(${sort})" ) fi @@ -425,13 +425,13 @@ for prepath in "$prepaths[@]"; do compadd -Qf "$mopts[@]" -p "$linepath$tmp4" -s "/${tmp3#*/}" \ -W "$prepath$realpath$testpath" "$ignore[@]" \ "$addpfx[@]" "$addsfx[@]" "$remsfx[@]" \ - -M "r:|/=* r:|=* $match" "$group[@]" "$expl[@]" \ + -M "r:|/=* r:|=* $mspec" "$group[@]" "$expl[@]" \ - "${(@)tmp1%%/*}" else compadd -Qf "$mopts[@]" -p "$linepath$tmp4" \ -W "$prepath$realpath$testpath" "$ignore[@]" \ "$addpfx[@]" "$addsfx[@]" "$remsfx[@]" \ - -M "r:|/=* r:|=* $match" "$group[@]" "$expl[@]" \ + -M "r:|/=* r:|=* $mspec" "$group[@]" "$expl[@]" \ - "$tmp1[@]" fi else @@ -439,7 +439,7 @@ for prepath in "$prepaths[@]"; do atmp=( -Qf "$mopts[@]" -p "$linepath$tmp4" -W "$prepath$realpath$testpath" "$ignore[@]" "$addpfx[@]" "$addsfx[@]" "$remsfx[@]" - -M "r:|/=* r:|=* $match" "$group[@]" "$expl[@]" ) + -M "r:|/=* r:|=* $mspec" "$group[@]" "$expl[@]" ) for i in "$tmp1[@]"; do compadd "$atmp[@]" -s "/${i#*/}" - "${i%%/*}" done @@ -447,7 +447,7 @@ for prepath in "$prepaths[@]"; do compadd -Qf "$mopts[@]" -p "$linepath$tmp4" \ -W "$prepath$realpath$testpath" "$ignore[@]" \ "$addpfx[@]" "$addsfx[@]" "$remsfx[@]" \ - -M "r:|/=* r:|=* $match" "$group[@]" "$expl[@]" \ + -M "r:|/=* r:|=* $mspec" "$group[@]" "$expl[@]" \ - "$tmp1[@]" fi fi @@ -497,7 +497,7 @@ for prepath in "$prepaths[@]"; do compadd -Qf "$mopts[@]" -p "$linepath$tmp4" \ -W "$prepath$realpath$testpath" "$ignore[@]" \ "$addpfx[@]" "$addsfx[@]" "$remsfx[@]" \ - -M "r:|/=* r:|=* $match" "$group[@]" "$expl[@]" \ + -M "r:|/=* r:|=* $mspec" "$group[@]" "$expl[@]" \ - "$tmp1[@]" fi done @@ -513,7 +513,7 @@ if zstyle -t ":completion${curcontext}:paths" expand prefix && PREFIX="${opre}" SUFFIX="${osuf}" compadd -Q "$mopts[@]" -S '' "$group[@]" "$expl[@]" \ - -M "r:|/=* r:|=* $match" -p "$linepath" - "$exppaths[@]" + -M "r:|/=* r:|=* $mspec" -p "$linepath" - "$exppaths[@]" fi [[ nm -ne compstate[nmatches] ]] -- cgit 1.4.1