From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11870 invoked from network); 31 Jan 2000 11:41:46 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 31 Jan 2000 11:41:46 -0000 Received: (qmail 28443 invoked by alias); 31 Jan 2000 11:41:42 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9494 Received: (qmail 28435 invoked from network); 31 Jan 2000 11:41:41 -0000 Date: Mon, 31 Jan 2000 12:41:40 +0100 (MET) Message-Id: <200001311141.MAA01396@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: Tanaka Akira's message of 30 Jan 2000 12:37:07 +0900 Subject: Re: completion just after an option by _arguments. Tanaka Akira wrote: > I found a problem with _arguments. > > Z:akr@is27e1u11% Src/zsh -f > is27e1u11% bindkey -e; autoload -U compinit; compinit -D; compdef _tst tst > is27e1u11% _tst () { _arguments '-x[desc]' } > is27e1u11% zstyle ':completion*:messages' format '%d' > is27e1u11% tst -x > no arguments > > It should insert a space. 3.1.6-pws-6 works so. Whew. This tries to fix it (it had inactivated the option description after it had found it, the patch basically makes it be activated again in such cases). Note that with `_arguments -s ...' the behaviour is still the same, but I think thats ok. At least I currently don't see a solution for that. Hm. maybe some trickery in _arguments... Bye Sven diff -ru ../z.old/Src/Zle/computil.c Src/Zle/computil.c --- ../z.old/Src/Zle/computil.c Mon Jan 31 11:35:54 2000 +++ Src/Zle/computil.c Mon Jan 31 12:35:05 2000 @@ -1019,7 +1019,7 @@ ca_parse_line(Cadef d) { Caarg adef, ddef; - Caopt ptr; + Caopt ptr, wasopt; struct castate state; char *line, *pe; int cur, doff; @@ -1107,6 +1107,8 @@ pe = NULL; + wasopt = NULL; + /* See if it's an option. */ if (state.opt == 2 && (state.curopt = ca_get_opt(d, line, 0, &pe)) && @@ -1141,8 +1143,11 @@ } if (state.def) state.opt = 0; - else + else { + if (!d->single || (state.curopt->name[1] && state.curopt->name[2])) + wasopt = state.curopt; state.curopt = NULL; + } } else if (state.opt == 2 && d->single && (state.curopt = ca_get_sopt(d, line, 0, &pe))) { /* Or maybe it's a single-letter option? */ @@ -1262,6 +1267,8 @@ ca_laststate.optbeg = state.nargbeg; ca_laststate.argbeg = state.restbeg; ca_laststate.singles = state.singles; + if (wasopt) + wasopt->active = 1; } } } -- Sven Wischnowsky wischnow@informatik.hu-berlin.de