summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2001-07-10 09:25:43 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2001-07-10 09:25:43 +0000
commitbd629defe8bf49b38a0e98b82f478d02dd715a81 (patch)
treedafe7b6313e28a8e7fbeeb139d79b8781de5be7b
parent5fcfa125bd4f0006c8207d1652908348f3ea526f (diff)
downloadzsh-bd629defe8bf49b38a0e98b82f478d02dd715a81.tar.gz
zsh-bd629defe8bf49b38a0e98b82f478d02dd715a81.zip
(15357)
-rw-r--r--ChangeLog9
-rw-r--r--Completion/Base/Completer/_prefix10
-rw-r--r--Src/Zle/compcore.c2
-rw-r--r--Src/Zle/zle_tricky.c2
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 <wischnow@zsh.org>
+
+ * 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 <schaefer@zsh.org>
* 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;
}