From 3e7fb1bef62df9fc5e679616696719901d7372b3 Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Wed, 16 Feb 2000 00:33:28 +0000 Subject: zsh-workers/9752 --- Completion/Core/_expand | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'Completion/Core') diff --git a/Completion/Core/_expand b/Completion/Core/_expand index e92c7966b..a6751290f 100644 --- a/Completion/Core/_expand +++ b/Completion/Core/_expand @@ -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 -- cgit 1.4.1