diff options
author | Tanaka Akira <akr@users.sourceforge.net> | 1999-11-15 12:01:46 +0000 |
---|---|---|
committer | Tanaka Akira <akr@users.sourceforge.net> | 1999-11-15 12:01:46 +0000 |
commit | 35b2633ad941966f5fca07b625a594a5b68c0fdb (patch) | |
tree | b54740d014e594ba5d81931cdcdb3387bcf9dfca /Completion/Core/_complete | |
parent | bb98460a01ce1f6c1e71f7e401f782c81b71486b (diff) | |
download | zsh-35b2633ad941966f5fca07b625a594a5b68c0fdb.tar.gz zsh-35b2633ad941966f5fca07b625a594a5b68c0fdb.tar.xz zsh-35b2633ad941966f5fca07b625a594a5b68c0fdb.zip |
manual/8639
Diffstat (limited to 'Completion/Core/_complete')
-rw-r--r-- | Completion/Core/_complete | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/Completion/Core/_complete b/Completion/Core/_complete index f351c7349..235265326 100644 --- a/Completion/Core/_complete +++ b/Completion/Core/_complete @@ -2,16 +2,21 @@ # Generate all possible completions. Note that this is not intended as # a normal completion function, but as one possible value for the -# compconfig[completer] parameter. +# completer style. -local comp name _tag_context="$_tag_context" +local comp name curcontext="$curcontext" oldcontext -[[ "$compstate[context]" != command || CURRENT -eq 1 ]] && - _tag_context="-${compstate[context]:s/_/-/}-" +# Probably set initial context. + +[[ -z "$curcontext" ]] && curcontext=':complete' + +oldcontext="$curcontext" # If we have a user-supplied context name, use only that. if [[ -n "$compcontext" ]]; then + curcontext="${curcontext}:$compcontext" + comp="$_comps[$compcontext]" [[ -z "$comp" ]] || "$comp" @@ -22,6 +27,7 @@ fi comp="$_comps[-first-]" if [[ ! -z "$comp" ]]; then + curcontext="${curcontext}:-first-" "$comp" if [[ "$_compskip" = all ]]; then _compskip='' @@ -34,12 +40,17 @@ fi # For arguments and command names we use the `_normal' function. if [[ "$compstate[context]" = command ]]; then + curcontext="$oldcontext" _normal -s else # Let's see if we have a special completion definition for the other # possible contexts. - comp="$_comps[$_tag_context]" + local cname="-${compstate[context]:s/_/-/}-" + + curcontext="${oldcontext}:$cname" + + comp="$_comps[$cname]" # If not, we use default completion, if any. |