From 3d0f90ba2b52aa93b9176362c3f1d479f21f220f Mon Sep 17 00:00:00 2001 From: Sven Wischnowsky Date: Tue, 11 Apr 2000 09:40:13 +0000 Subject: make _oldlist ignore list from _complete_help; _match runs for every match spec from matcher-list; _approximate doesn't redefine compadd if that is already a function (10641) --- Completion/Core/_approximate | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'Completion/Core/_approximate') diff --git a/Completion/Core/_approximate b/Completion/Core/_approximate index 0815a308e..840c1729a 100644 --- a/Completion/Core/_approximate +++ b/Completion/Core/_approximate @@ -10,7 +10,7 @@ [[ _matcher_num -gt 1 || "${#:-$PREFIX$SUFFIX}" -le 1 ]] && return 1 -local _comp_correct _correct_expl comax cfgacc +local _comp_correct _correct_expl comax cfgacc redef local oldcontext="${curcontext}" opm="$compstate[pattern_match]" zstyle -s ":completion:${curcontext}:" max-errors cfgacc || cfgacc='2 numeric' @@ -40,17 +40,20 @@ _tags corrections original # to stick the `(#a...)' in the right place (after an # ignored prefix). -compadd() { - [[ ${argv[(I)-[a-zA-Z]#U[a-zA-Z]#]} -eq 0 && - "${#:-$PREFIX$SUFFIX}" -le _comp_correct ]] && return +if (( ! $+functions[compadd] )); then + redef=yes + compadd() { + [[ ${argv[(I)-[a-zA-Z]#U[a-zA-Z]#]} -eq 0 && + "${#:-$PREFIX$SUFFIX}" -le _comp_correct ]] && return - if [[ "$PREFIX" = \~*/* ]]; then - PREFIX="${PREFIX%%/*}/(#a${_comp_correct})${PREFIX#*/}" - else - PREFIX="(#a${_comp_correct})$PREFIX" - fi - builtin compadd "$_correct_expl[@]" "$@" -} + if [[ "$PREFIX" = \~*/* ]]; then + PREFIX="${PREFIX%%/*}/(#a${_comp_correct})${PREFIX#*/}" + else + PREFIX="(#a${_comp_correct})$PREFIX" + fi + builtin compadd "$_correct_expl[@]" "$@" + } +fi _comp_correct=1 @@ -81,7 +84,7 @@ while [[ _comp_correct -le comax ]]; do [[ "$compstate[list]" != list* ]] && compstate[list]="$compstate[list] force" fi - unfunction compadd + [[ -n "$redef" ]] && unfunction compadd compstate[pattern_match]="$opm" return 0 @@ -91,7 +94,7 @@ while [[ _comp_correct -le comax ]]; do (( _comp_correct++ )) done -unfunction compadd +[[ -n "$redef" ]] && unfunction compadd compstate[pattern_match]="$opm" return 1 -- cgit 1.4.1