zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: minor niggle with svn completion of sub-commands
Date: Sun, 15 Nov 2009 16:17:50 -0800	[thread overview]
Message-ID: <091115161750.ZM29484@torch.brasslantern.com> (raw)
In-Reply-To: <m3639cw7oc.fsf@klanderman.net>

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));


  reply	other threads:[~2009-11-16  1:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-09 16:36 Greg Klanderman
2009-11-09 21:46 ` Greg Klanderman
2009-11-12 17:53   ` Greg Klanderman
2009-11-12 19:25     ` Peter Stephenson
2009-11-14 20:05       ` Greg Klanderman
2009-11-15  7:47         ` Greg Klanderman
2009-11-16  0:17           ` Bart Schaefer [this message]
2009-11-16 19:45             ` Greg Klanderman
2009-11-17  4:01               ` Bart Schaefer
2009-11-17 15:55                 ` comparguments (was Re: minor niggle with svn completion of sub-commands) Bart Schaefer
2009-12-06 22:11                   ` Greg Klanderman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=091115161750.ZM29484@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).