1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-11-01 18:30:55 +01:00

zsh-workers/9752

This commit is contained in:
Tanaka Akira 2000-02-16 00:33:28 +00:00
parent 90c88e53df
commit 3e7fb1bef6

View file

@ -7,7 +7,7 @@
# the expansions done produce no result or do not change the original
# word from the line.
local exp word="$PREFIX$SUFFIX" sort expr expl
local exp word="$PREFIX$SUFFIX" sort expr expl subd
local curcontext="${curcontext/:[^:]#:/:expand:}"
# First, see if we should insert all *completions*.
@ -34,18 +34,26 @@ zstyle -s ":completion:${curcontext}:" substitute expr &&
[[ -z "$exp" ]] && exp=("$word")
subd="$exp"
# Now try globbing.
zstyle -s ":completion:${curcontext}:" glob expr &&
[[ "${(e):-\$[$expr]}" -eq 1 ]] &&
exp=( ${~exp}(N) )
# If we don't have any expansions or only one and that is the same
# as the original string, we let other completers run.
[[ $#exp -eq 0 ||
( $#exp -eq 1 && "$exp[1]" = "$word"(|\(N\)) ) ]] && return 1
# With subst-globs-only we bail out if there were no glob expansions,
# regardless of any substitutions
zstyle -s ":completion:${curcontext}:" subst-globs-only expr &&
[[ "${(e):-\$[$expr]}" -eq 1 ]] &&
[[ "$subd" = "$exp"(|\(N\)) ]] && return 1
# Now add as matches whatever the user requested.
zstyle -s ":completion:${curcontext}:" sort sort