From 428abf6455c9df0dfaca05165764eb842da7e2d9 Mon Sep 17 00:00:00 2001 From: Sven Wischnowsky Date: Tue, 13 Jun 2000 11:26:07 +0000 Subject: new style `suffix'; use accept-exact style in _expand (?) --- Completion/Core/_expand | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'Completion') 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") -- cgit 1.4.1