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

Re: PATCH: Updated _rpm, but a bug with _arguments



On May 30,  3:19am, Bart Schaefer wrote:
} Subject: PATCH: Updated _rpm, but a bug with _arguments
}
} As of the current CVS sources (_arguments revision 1.25) completion for rpm
} doesn't work any longer:
} 
} zagzig[24] rpm --rc<TAB>
} Completing no arguments
} (beep)

It's actually much worse than this; option completion is entirely broken
when there's anything in the current word other than the leading hyphens.
The culprits seem to be the following two hunks of 11624; for example, if
I delete the `&& !line[2]' then completion after two hyphens and an alpha-
numeric starts working again, but one hyphen and an alphanum still fails.

x@ -1434,7 +1436,11 @@
                (state.def->type == CAA_RREST ||
                 state.def->type == CAA_RARGS)) {
                state.inrest = 0;
-               state.opt = (cur == state.nargbeg + 1);
+               state.opt = (cur == state.nargbeg + 1 &&
+                            (!*line || 
+                             ((*line == '-' || *line == '+') &&
+                              (!line[1] ||
+                               (*line == '-' && line[1] == '-' && !line[2])))));
                state.optbeg = state.nargbeg;
                state.argbeg = cur - 1;
                state.argend = argend;
x@ -1510,6 +1516,10 @@
                }
            } else {
                ca_laststate.def = adef;
+               ca_laststate.opt = (!arglast || !*line || 
+                                   ((*line == '-' || *line == '+') &&
+                                    (!line[1] ||
+                                     (*line == '-' && line[1] == '-' && !line[2]))));
                ca_laststate.ddef = NULL;
                ca_laststate.dopt = NULL;
                ca_laststate.optbeg = state.nargbeg;

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



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