From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15463 invoked by alias); 16 Nov 2009 01:18:14 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 27411 Received: (qmail 3158 invoked from network); 16 Nov 2009 01:18:11 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <091115161750.ZM29484@torch.brasslantern.com> Date: Sun, 15 Nov 2009 16:17:50 -0800 In-reply-to: Comments: In reply to Greg Klanderman "Re: minor niggle with svn completion of sub-commands" (Nov 15, 2:47am) References: <19192.17676.966894.118536@gargle.gargle.HOWL> <20091112192553.2d76ce1d@pws-pc> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: minor niggle with svn completion of sub-commands MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Nov 15, 2:47am, Greg Klanderman wrote: } } Here's a simple test showing that the '*::...' type argument } descriptions are not handled correctly by _arguments: It all goes awry at computil.c line 2133: if ((adef = state.def = ca_get_arg(d, state.nth)) && (state.def->type == CAA_RREST || state.def->type == CAA_RARGS)) { for the '*::' case, state.def->type == CAA_RREST so we enter the block at 2136 and exit the entire loop at the "break" on 2151. Line 2133 is the only place that RREST and RARGS are treated differently than REST (line 2173 doesn't count as that's for the case of an argument of an option ("optspec"), not a "normal argument"). The problem seems to be that we blindly clobber ca_laststate upon discovering that we've reached the "rest" description. The patch below changes this behavior but I'm not certain it's complete; it may need an "else" clause, or maybe we should be breaking out of the entire loop elsewhere as soon as ca_laststate.def is non-NULL. This patch may claim it applies with an offset, it's a diff against my own repository rather than the official one. Index: computil.c =================================================================== RCS file: /extra/cvsroot/zsh/zsh-4.0/Src/Zle/computil.c,v retrieving revision 1.32 diff -c -r1.32 computil.c --- computil.c 23 Nov 2008 18:26:28 -0000 1.32 +++ computil.c 16 Nov 2009 00:10:26 -0000 @@ -2130,10 +2144,12 @@ for (; line; line = compwords[cur++]) zaddlinknode(state.args, ztrdup(line)); - memcpy(&ca_laststate, &state, sizeof(state)); - ca_laststate.ddef = NULL; - ca_laststate.dopt = NULL; - ca_laststate.doff = 0; + if (!ca_laststate.def) { + memcpy(&ca_laststate, &state, sizeof(state)); + ca_laststate.ddef = NULL; + ca_laststate.dopt = NULL; + ca_laststate.doff = 0; + } break; } zaddlinknode(state.args, ztrdup(line));