Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Silly questions about _arguments & Co (and probably bugs)



Tanaka Akira wrote:

> I think `compconf option_prefix=all' is useful.

(Btw, the value of option_prefix isn't used any more -- only whether
it's empty or not.)

> And, I found another problem. `patch -f<TAB>' does not show list of
> completion candidates. However completion itself works well.
> 
> ...
> 
> So, I think this is the problem of `_display'.

Almost. There were two problems: with single-letter options
PREFIX/SUFFIX weren't cleared before `_display' was called (so that
(almost) no option matched) and the return value of `_display' wasn't
used to find out that `_arguments' should create the list itself.

Bye
 Sven

diff -u -r oldcompletion/Base/_arguments Completion/Base/_arguments
--- oldcompletion/Base/_arguments	Mon Sep 13 13:13:10 1999
+++ Completion/Base/_arguments	Mon Sep 13 13:51:43 1999
@@ -822,12 +822,17 @@
     if [[ -n "$sopts" && -n "$PREFIX" &&
       "$PREFIX" = [-+]${~soptseq}[$sopts] ]]; then
       if [[ "$PREFIX" = [-+]${~soptseq1} ]]; then
-        if [[ -n "$compconfig[describe_options]" &&
-              "$compconfig[describe_options]" != *\!${cmd}* ]]; then
-          _display tmp odescr
-        else
-          tmp="( ${(j: :)${(@)${(@M)${=:-${(k)opts} ${(k)dopts} ${(k)odopts}}:#[-+]?(|=)}#?}%=} )"
+        local dpre="$PREFIX" dsuf="$SUFFIX"
+
+	PREFIX=''
+	SUFFIX=''
+        if [[ -z "$compconfig[describe_options]" ||
+              "$compconfig[describe_options]" = *\!${cmd}* ]] ||
+           ! _display tmp odescr; then
+          tmp=( "${dpre[1]}${(@o)^${(@)${(@M)${=:-${(k)opts} ${(k)dopts} ${(k)odopts}}:#[-+]?(|=)}#?}%=}" )
         fi
+	PREFIX="$dpre"
+	SUFFIX="$dsuf"
         compadd "$expl[@]" -Q -M 'r:|[_-]=* r:|=*' -y tmp - \
                 "${PREFIX}${(@k)^opts[(I)${PREFIX[1]}?]#?}" \
 	        "${PREFIX}${(@k)^dopts[(I)${PREFIX[1]}?]#?}" \

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author