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

Re: configure --with- completion



On 2015/10/22, at 1:11, Jun T. <takimoto-j@xxxxxxxxxxxxxxxxx> wrote:
> 
> But this patch has effect only with '_arguments --', and does not fix
> the example above (-x and -xy). Patching computil.c would be better ...

So this is a minimal patch I can think of.
Is this reasonable?

diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c
index e5db086..b664f30 100644
--- a/Src/Zle/computil.c
+++ b/Src/Zle/computil.c
@@ -1693,10 +1693,13 @@ ca_get_opt(Cadef d, char *line, int full, char **end)
 	for (p = d->opts; p; p = p->next)
 	    if (p->active && ((!p->args || p->type == CAO_NEXT) ?
 			      !strcmp(p->name, line) : strpfx(p->name, line))) {
+		int l = strlen(p->name);
+		if ((p->type == CAO_OEQUAL || p->type == CAO_EQUAL) &&
+		    line[l] && line[l] != '=')
+		    continue;
+
 		if (end) {
 		    /* Return a pointer to the end of the option. */
-		    int l = strlen(p->name);
-
 		    if ((p->type == CAO_OEQUAL || p->type == CAO_EQUAL) &&
 			line[l] == '=')
 			l++;





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