1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-08 12:01:21 +02:00

zsh-workers/9197

This commit is contained in:
Tanaka Akira 2000-01-04 14:57:19 +00:00
parent d05db5e29f
commit f71a7de56f
3 changed files with 20 additions and 6 deletions

View file

@ -93,7 +93,11 @@ while true; do
else
# No exact match, see how many strings match what's on the line.
compadd -O tmp1 - "${(@)matches%%${sep}*}"
builtin compadd -O tmp1 - "${(@)matches%%${sep}*}"
[[ $#tmp1 -eq 0 && -n "$_comp_correct" ]] &&
compadd -O tmp1 - "${(@)matches%%${sep}*}"
tmp2=( "$tmp1[@]" )
tmp1=( "$tmp2[@]" )

View file

@ -265,8 +265,12 @@ for prepath in "$prepaths[@]"; do
if [[ -n "$PREFIX$SUFFIX" ]]; then
# See which of them match what's on the line.
tmp2=("$tmp1[@]")
compadd -D tmp1 "$ignore[@]" "$matcher[@]" - "${(@)tmp1:t}"
builtin compadd -D tmp1 "$ignore[@]" "$matcher[@]" - "${(@)tmp1:t}"
if [[ $#tmp1 -eq 0 && -n "$_comp_correct" ]]; then
tmp1=( "$tmp2[@]" )
compadd -D tmp1 "$ignore[@]" "$matcher[@]" - "${(@)tmp2:t}"
fi
# If no file matches, save the expanded path and continue with
# the outer loop.

View file

@ -63,7 +63,9 @@ while [[ $# -gt 1 ]]; do
# Get the matching array elements.
PREFIX="${str%%${sep}*}"
compadd -O testarr - "${(@P)arr}"
builtin compadd -O testarr - "${(@P)arr}"
[[ $#testarr -eq 0 && -n "$_comp_correct" ]] &&
compadd -O testarr - "${(@P)arr}"
# If there are no matches we give up. If there is more than one
# match, this is the part we will complete.
@ -91,7 +93,9 @@ if [[ $# -le 1 || "$str" != *${2}* ]]; then
# No more separators, build the matches.
PREFIX="$str"
compadd -O testarr - "${(@P)arr}"
builtin compadd -O testarr - "${(@P)arr}"
[[ $#testarr -eq 0 && -n "$_comp_correct" ]] &&
compadd -O testarr - "${(@P)arr}"
fi
[[ $#testarr -eq 0 || ${#testarr[1]} -eq 0 ]] && return 1
@ -126,7 +130,9 @@ while [[ $# -gt 0 && "$str" == *${1}* ]]; do
arr=tmparr
fi
compadd -O tmparr - "${(@P)arr}"
builtin compadd -O tmparr - "${(@P)arr}"
[[ $#tmparr -eq 0 && -n "$_comp_correct" ]] &&
compadd -O tmparr - "${(@P)arr}"
suffixes=("${(@)^suffixes[@]}${1}${(@)^tmparr}")