1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2026-01-05 21:31:29 +01:00

new style `suffix'; use accept-exact style in _expand (?)

This commit is contained in:
Sven Wischnowsky 2000-06-13 11:26:07 +00:00
parent a2417f6863
commit 428abf6455
3 changed files with 35 additions and 7 deletions

View file

@ -1,5 +1,8 @@
2000-06-13 Sven Wischnowsky <wischnow@zsh.org>
* ?????: Completion/Core/_expand, Doc/Zsh/compsys.yo: new style
`suffix', use accept-exact style in _expand
* ?????: Src/Zle/complist.c: fix for longer capability strings;
very bad

View file

@ -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")

View file

@ -779,6 +779,12 @@ This is tested for the default tag and the tags used when generating
matches. If it is set to `true' for at least one match which is the
same as the string on the line, this match will immediately be
accepted.
Note that this is also used by the tt(_expand) completer to decide if
words beginning with a tilde or parameter expansion should be
expanded. This means that if, for example, there are parameters
tt(foo) and tt(foobar), the string `tt($foo)' will only be expanded if
tt(accept-exact) is set to `true'.
)
kindex(add-space, completion style)
item(tt(add-space))(
@ -1786,6 +1792,14 @@ example(zstyle ':completion:*:expand:::' substitute '${NUMERIC:-1} != 1')
substitution will be performed only if given an explicit numeric
argument other than `tt(1)', as by typing `tt(ESC 2 TAB)'.
)
kindex(suffix, completion style)
item(tt(suffix))(
This is used by the tt(_expand) completer if the word starts with a
tilde or parameter expansion. If it is set to `true', the word will
only be expanded if it doesn't have a suffix, i.e. if it is something
like `tt(~foo)' or `tt($foo)', but not if it is `tt(~foo/)' or
`tt($foo/bar)'. The default for this style is `false'.
)
kindex(tag-order, completion style)
item(tt(tag-order))(
This provides a mechanism for sorting how the tags available in a