summaryrefslogtreecommitdiffstats
path: root/Completion/Core
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>2000-02-16 00:33:28 +0000
committerTanaka Akira <akr@users.sourceforge.net>2000-02-16 00:33:28 +0000
commit3e7fb1bef62df9fc5e679616696719901d7372b3 (patch)
tree8419a7064b2a73a21aa5226182cb8479151761dd /Completion/Core
parentzsh-workers/9750 (diff)
downloadzsh-3e7fb1bef62df9fc5e679616696719901d7372b3.tar
zsh-3e7fb1bef62df9fc5e679616696719901d7372b3.tar.gz
zsh-3e7fb1bef62df9fc5e679616696719901d7372b3.tar.bz2
zsh-3e7fb1bef62df9fc5e679616696719901d7372b3.tar.lz
zsh-3e7fb1bef62df9fc5e679616696719901d7372b3.tar.xz
zsh-3e7fb1bef62df9fc5e679616696719901d7372b3.tar.zst
zsh-3e7fb1bef62df9fc5e679616696719901d7372b3.zip
zsh-workers/9752
Diffstat (limited to 'Completion/Core')
-rw-r--r--Completion/Core/_expand12
1 files changed, 10 insertions, 2 deletions
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