From bd629defe8bf49b38a0e98b82f478d02dd715a81 Mon Sep 17 00:00:00 2001 From: Sven Wischnowsky Date: Tue, 10 Jul 2001 09:25:43 +0000 Subject: (15357) --- ChangeLog | 9 +++++++++ Completion/Base/Completer/_prefix | 10 ++++++++-- Src/Zle/compcore.c | 2 +- Src/Zle/zle_tricky.c | 2 ++ 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0e715bd44..11ee850f3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2001-07-10 Sven Wischnowsky + + * 15357: Completion/Base/Completer/_prefix, Src/Zle/compcore.c, + Src/Zle/zle_tricky.c: prefix completion: make e-o-c-p leave a + space before the cursor, make _prefix leave the cursor after + the inserted match even if only a single match; and make the + C-code not show explanation strings if the completion function + it doesn't want a list + 2001-07-10 Bart Schaefer * 15354: Doc/Zsh/arith.yo, Doc/Zsh/builtins.yo, Doc/Zsh/compat.yo, diff --git a/Completion/Base/Completer/_prefix b/Completion/Base/Completer/_prefix index 86fad12dc..3ec153245 100644 --- a/Completion/Base/Completer/_prefix +++ b/Completion/Base/Completer/_prefix @@ -4,7 +4,7 @@ [[ _matcher_num -gt 1 || -z "$SUFFIX" ]] && return 1 -local comp curcontext="$curcontext" tmp \ +local comp curcontext="$curcontext" tmp suf="$SUFFIX" \ _completer _completer_num \ _matcher _c_matcher _matchers _matcher_num @@ -44,7 +44,13 @@ for tmp in "$comp[@]"; do _matcher="$_c_matcher" fi - [[ "$tmp" != _prefix ]] && "$tmp" && return 0 + if [[ "$tmp" != _prefix ]] && "$tmp"; then + [[ compstate[nmatches] -gt 1 ]] && return 0 + compadd -U -i "$IPREFIX" -I "$ISUFFIX" - "${compstate[unambiguous]%$suf}x" + compstate[list]= + compstate[insert]=unambiguous + return 0 + fi (( _matcher_num++ )) done (( _completer_num++ )) diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c index 887557f40..97ed6d58f 100644 --- a/Src/Zle/compcore.c +++ b/Src/Zle/compcore.c @@ -420,7 +420,7 @@ do_completion(Hookdef dummy, Compldat dat) cs = origcs; } /* Print the explanation strings if needed. */ - if (!showinglist && validlist && usemenu != 2 && + if (!showinglist && validlist && usemenu != 2 && uselist && (nmatches != 1 || diffmatches) && useline >= 0 && useline != 2 && (!oldlist || !listshown)) { onlyexpl = 3; diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c index 515fb9e97..ca1a50ce1 100644 --- a/Src/Zle/zle_tricky.c +++ b/Src/Zle/zle_tricky.c @@ -2363,6 +2363,8 @@ expandorcompleteprefix(char **args) comppref = 1; ret = expandorcomplete(args); + if (cs && line[cs - 1] == ' ') + makesuffixstr(NULL, "\\-", 0); comppref = 0; return ret; } -- cgit 1.4.1