diff options
author | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2000-05-08 08:16:32 +0000 |
---|---|---|
committer | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2000-05-08 08:16:32 +0000 |
commit | 92637abbb870dc35e1af9150741f7b11587a3350 (patch) | |
tree | 0720a090889ec58db87992e6a4e9712a1c939739 /Completion/Core/_prefix | |
parent | c15091b7d196c8fcc15bf8f13f8c7ccf62479b85 (diff) | |
download | zsh-92637abbb870dc35e1af9150741f7b11587a3350.tar.gz zsh-92637abbb870dc35e1af9150741f7b11587a3350.tar.xz zsh-92637abbb870dc35e1af9150741f7b11587a3350.zip |
misc. completion cleanups and changes (11242)
Diffstat (limited to 'Completion/Core/_prefix')
-rw-r--r-- | Completion/Core/_prefix | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/Completion/Core/_prefix b/Completion/Core/_prefix index f6e3b0831..18e6e3270 100644 --- a/Completion/Core/_prefix +++ b/Completion/Core/_prefix @@ -2,9 +2,10 @@ # Try to ignore the suffix. A bit like e-o-c-prefix. -[[ -n "$SUFFIX" ]] || return 1 +[[ _matcher_num -gt 1 || -z "$SUFFIX" ]] && return 1 -local comp i +local comp curcontext="$curcontext" tmp \ + _completer _completer_num _matcher _matchers _matcher_num zstyle -a ":completion:${curcontext}:" completer comp || comp=( "${(@)_completers[1,_completer_num-1][(R)_prefix(|:*),-1]}" ) @@ -16,8 +17,29 @@ else fi SUFFIX='' -for i in "$comp[@]"; do - [[ "$i" != _prefix ]] && "$i" && return 0 +_completer_num=1 + +for tmp in "$comp[@]"; do + if [[ "$tmp" = *:-* ]]; then + _completer="${${tmp%:*}[2,-1]//_/-}${tmp#*:}" + tmp="${tmp%:*}" + elif [[ $tmp = *:* ]]; then + _completer="${tmp#*:}" + tmp="${tmp%:*}" + else + _completer="${tmp[2,-1]//_/-}" + fi + curcontext="${curcontext/:[^:]#:/:${_completer}:}" + + zstyle -a ":completion:${curcontext}:" matcher-list _matchers || + _matchers=( '' ) + + _matcher_num=1 + for _matcher in "$_matchers[@]"; do + [[ "$tmp" != _prefix ]] && "$tmp" && return 0 + (( _matcher_num++ )) + done + (( _completer_num++ )) done return 1 |