diff options
-rw-r--r-- | Completion/Base/_arguments | 2 | ||||
-rw-r--r-- | Src/Zle/computil.c | 10 |
2 files changed, 9 insertions, 3 deletions
diff --git a/Completion/Base/_arguments b/Completion/Base/_arguments index f7a20ee96..e74b2763e 100644 --- a/Completion/Base/_arguments +++ b/Completion/Base/_arguments @@ -247,7 +247,7 @@ if comparguments -i "$compconfig[autodescribe_options]" "$@"; then compadd "$expl[@]" -QqS= - "${PREFIX}${SUFFIX}" else tmp1=( "$next[@]" "$direct[@]" "$odirect[@]" "$equal[@]" ) - tmp2=( "${PREFIX}${(@)^tmp1%%:*}" ) + tmp2=( "${PREFIX}${(@M)^${(@)${(@)tmp1%%:*}#[-+]}:#?}" ) _describe -o -c "$cmd" option tmp1 tmp2 -Q -S '' fi diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c index e1ce68865..a79044d6e 100644 --- a/Src/Zle/computil.c +++ b/Src/Zle/computil.c @@ -854,6 +854,8 @@ ca_get_sopt(Cadef d, char *line, int full, char **end) break; } else if (!p || !p->active || (line[1] && p->args)) return NULL; + if (end) + *end = line; return p; } return NULL; @@ -982,6 +984,9 @@ ca_parse_line(Cadef d) ddef = state.def = state.curopt->args; doff = pe - line; state.optbeg = state.argbeg = state.inopt = cur; + state.singles = (d->single && (!pe || !*pe) && + state.curopt->name[1] && !state.curopt->name[2]); + PERMALLOC { state.oargs[state.curopt->num] = newlinklist(); } LASTALLOC; @@ -1010,7 +1015,7 @@ ca_parse_line(Cadef d) ddef = state.def = state.curopt->args; doff = pe - line; state.optbeg = state.argbeg = state.inopt = cur; - state.singles = !*pe; + state.singles = (!pe || !*pe); for (p = line + 1; p <= pe; p++) { if ((tmpopt = d->single[STOUC(*p)])) { @@ -1189,7 +1194,8 @@ bin_comparguments(char *nam, char **args, char *ops, int func) setsparam(args[1], ztrdup(arg->descr)); setsparam(args[2], ztrdup(arg->action)); - ignore_prefix(ca_laststate.doff); + if (ca_laststate.doff > 0) + ignore_prefix(ca_laststate.doff); if (arg->type == CAA_RARGS) restrict_range(ca_laststate.argbeg - 1, arrlen(compwords) - 1); |