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

Re: PATCH: _archie



Tanaka Akira wrote:

> I wrote a completion function for _archie.
> 
> But it has a problem.
> 
> Z:akr@is27e1u11% Src/zsh -f
> is27e1u11% bindkey -e; fpath=($PWD/Completion/*(/)); autoload -U compinit; compinit -D; compdef _tst tst
> is27e1u11% compconf group_matches=yes message_format='%d' description_format='%d'
> is27e1u11% compconf describe_options=yes describe_values=yes option_prefix=yes
> is27e1u11% archie -<TAB>
> 
> ->
> 
> is27e1u11% archie -
> string
> 
> Why aren't descriptions of options displayed?

Combination of `computil' not reporting that options are allowed at
that position and a bit of stupidity in `_arguments'.


You are writing a lot of interesting completion functions, very nice,
thank you.

And before I forget to mention it... if someone wonders why I changed
`_dvi' to use `_arguments' a while ago, but didn't change `_ps' and
`_pspdf' and why I added `_yp', but not `_nis' (for the NIS+
commands): it's because I don't have many of the commands mentioned in 
`_ps' and `_pspdf' and we don't have NIS+ installed here, so I
couldn't test a completion function for it. So if someone finds the
time...

Bye
 Sven

diff -u oldsrc/Zle/computil.c Src/Zle/computil.c
--- oldsrc/Zle/computil.c	Mon Oct 18 11:10:39 1999
+++ Src/Zle/computil.c	Mon Oct 18 11:10:52 1999
@@ -976,13 +976,13 @@
 	    else
 		state.curopt = NULL;
 	} else {
-	    state.opt = (line[0] && line[1]);
+	    state.opt = (line[0] ? (line[1] ? 2 : 1) : 0);
 	    state.arg = 1;
 	    state.curopt = NULL;
 	}
 	pe = NULL;
 
-	if (state.opt && (state.curopt = ca_get_opt(d, line, 0, &pe))) {
+	if (state.opt == 2 && (state.curopt = ca_get_opt(d, line, 0, &pe))) {
 	    ddef = state.def = state.curopt->args;
 	    doff = pe - line;
 	    state.optbeg = state.argbeg = state.inopt = cur;
@@ -1009,7 +1009,7 @@
 	    }
 	    if (!state.def)
 		state.curopt = NULL;
-	} else if (state.opt && d->single &&
+	} else if (state.opt == 2 && d->single &&
 		   (state.curopt = ca_get_sopt(d, line, 0, &pe))) {
 	    char *p;
 	    Caopt tmpopt;
diff -u oldcompletion/Base/_arguments Completion/Base/_arguments
--- oldcompletion/Base/_arguments	Mon Oct 18 09:48:45 1999
+++ Completion/Base/_arguments	Mon Oct 18 11:11:27 1999
@@ -190,7 +190,6 @@
 
           [[ -n "$matched" ]] && compadd -n -Q -S '' -s "$SUFFIX" - "$PREFIX"
           _message "$descr"
-          break
 
         elif [[ "$action" = \(\(*\)\) ]]; then
 

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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