about summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2000-06-13 11:26:07 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2000-06-13 11:26:07 +0000
commit428abf6455c9df0dfaca05165764eb842da7e2d9 (patch)
tree372d65250fb196a2a6506c7097ac279f00534c73 /Completion
parenta2417f68636e69c4ba5c9ae441277b84619314b6 (diff)
downloadzsh-428abf6455c9df0dfaca05165764eb842da7e2d9.tar.gz
zsh-428abf6455c9df0dfaca05165764eb842da7e2d9.tar.xz
zsh-428abf6455c9df0dfaca05165764eb842da7e2d9.zip
new style `suffix'; use accept-exact style in _expand (?)
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Core/_expand25
1 files changed, 18 insertions, 7 deletions
diff --git a/Completion/Core/_expand b/Completion/Core/_expand
index 25145f752..9ba055a6e 100644
--- a/Completion/Core/_expand
+++ b/Completion/Core/_expand
@@ -18,12 +18,6 @@ local exp word sort expr expl subd suf=" " force opt asp tmp opre pre epre
       force="$force$opt"
     done
 
-if [[ "$funcstack[2]" = _prefix ]]; then
-  word="$IPREFIX$PREFIX$SUFFIX"
-else
-  word="$IPREFIX$PREFIX$SUFFIX$ISUFFIX"
-fi
-
 # First, see if we should insert all *completions*.
 
 if [[ "$force" = *c* ]] ||
@@ -34,7 +28,24 @@ if [[ "$force" = *c* ]] ||
   return 1
 fi
 
-# In exp we will collect the expansion.
+if [[ "$funcstack[2]" = _prefix ]]; then
+  word="$IPREFIX$PREFIX$SUFFIX"
+else
+  word="$IPREFIX$PREFIX$SUFFIX$ISUFFIX"
+fi
+
+zstyle -t ":completion:${curcontext}:" suffix &&
+  [[ "$word" = (\~*/*|\$[a-zA-Z0-9_]##[^a-zA-Z0-9_]*|\$\{*\}?*) ]] &&
+  return 1
+
+zstyle -t ":completion:${curcontext}:" accept-exact ||
+  { [[ "$word" = \~(|[-+]) ||
+       ( "$word" = \~[-+][1-9]## && $word[3,-1] -le $#dirstack ) ||
+       ( "$word" = \~* && ${#userdirs[(I)${word[2,-1]}*]}+${#nameddirs[(I)${word[2,-1]}*]} -ne 1 ) ||
+       ( "$word" = \$[a-zA-Z0-9_]## && 
+         ${#parameters[(I)${word[2,-1]}*]} -ne 1 ) ]] && return 1 }
+
+# In exp we will collect the expansions.
 
 exp=("$word")