From 346825df86466cf151be61b9429ef2c1734e66ea Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Sun, 27 Jun 1999 05:33:04 +0000 Subject: zsh-3.1.5-pws-24 --- Completion/Core/_match | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'Completion/Core/_match') diff --git a/Completion/Core/_match b/Completion/Core/_match index 3c639935c..251c65381 100644 --- a/Completion/Core/_match +++ b/Completion/Core/_match @@ -9,7 +9,7 @@ # expand-or-complete function because otherwise the pattern will # be expanded using globbing. # -# Configuration key used: +# Configuration keys used: # # match_original # If this is set to a `only', pattern matching will only be tried @@ -18,6 +18,11 @@ # no completions, matching will be tried again with a `*' inserted # at the cursor position. If this key is not set or set to an empty # string, matching will only be attempted with the `*' inserted. +# +# match_insert +# If this is set to a string starting with `unambig', menucompletion +# will only be turned on if no unambiguous string could be built +# that is at least as long as the original string. local tmp opm="$compstate[pattern_match]" ret=0 @@ -37,7 +42,12 @@ if [[ -n "$compconfig[match_original]" ]]; then compstate[pattern_match]="$opm" compstate[matcher]="$compstate[total_matchers]" - (( ret )) && return 0 + if (( ret )); then + [[ "$compconfig[match_insert]" = unambig* && + $#compstate[unambiguous] -ge ${#:-${PREFIX}${SUFFIX}} ]] && + compstate[pattern_insert]=unambiguous + return 0 + fi fi # No completion with inserting `*'? @@ -50,4 +60,10 @@ _complete && ret=1 compstate[pattern_match]="$opm" compstate[matcher]="$compstate[total_matchers]" +if (( ! ret )); then + [[ "$compconfig[match_insert]" = unambig* && + $#compstate[unambiguous] -ge ${#:-${PREFIX}${SUFFIX}} ]] && + compstate[pattern_insert]=unambiguous +fi + return 1-ret -- cgit 1.4.1