diff options
-rw-r--r-- | Doc/Zsh/compwid.yo | 3 | ||||
-rw-r--r-- | Src/Zle/zle_tricky.c | 46 |
2 files changed, 48 insertions, 1 deletions
diff --git a/Doc/Zsh/compwid.yo b/Doc/Zsh/compwid.yo index 2c68e5d64..d4b9dd797 100644 --- a/Doc/Zsh/compwid.yo +++ b/Doc/Zsh/compwid.yo @@ -259,6 +259,9 @@ around, so that a value of zero selects the last match or group and a value one more than the maximum selects the first. Unless the value of this key ends in a space, the match is inserted as in a menu-completion, i.e. without automatically appending a space. + +It may also be set to tt(all), which makes all matches generated be +inserted into the line. ) item(tt(to_end))( Specifies the occasions on which the cursor is moved to the end of a string diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c index e44f684c2..0d6127c6f 100644 --- a/Src/Zle/zle_tricky.c +++ b/Src/Zle/zle_tricky.c @@ -4609,6 +4609,48 @@ docompletion(char *s, int lst, int incmd) inststr(origline); cs = origcs; showinglist = -2; + } else if (useline == 2 && nmatches > 1) { + int first = 1, nm = nmatches; + Cmatch *mc; + + menucmp = 1; + menuacc = 0; + + for (minfo.group = amatches; + minfo.group && !(minfo.group)->mcount; + minfo.group = (minfo.group)->next); + + mc = (minfo.group)->matches; + + while (1) { + if (!first) + acceptlast(); + first = 0; + + if (!--nm) + menucmp = 0; + + do_single(*mc); + minfo.cur = mc; + + if (!*++(minfo.cur)) { + do { + if (!(minfo.group = (minfo.group)->next)) + break; + } while (!(minfo.group)->mcount); + if (!minfo.group) + break; + minfo.cur = minfo.group->matches; + } + mc = minfo.cur; + } + menucmp = 0; + minfo.cur = NULL; + + if (compforcelist && *compforcelist && uselist) + showinglist = -2; + else + invalidatelist(); } else if (useline) { /* We have matches. */ if (nmatches > 1) { @@ -4637,7 +4679,7 @@ docompletion(char *s, int lst, int incmd) } /* Print the explanation strings if needed. */ if (!showinglist && validlist && usemenu != 2 && nmatches != 1 && - (!oldlist || !listshown)) { + useline != 2 && (!oldlist || !listshown)) { Cmgroup g = amatches; Cexpl *e; int up = 0, tr = 1, nn = 0; @@ -4948,6 +4990,8 @@ callcompfunc(char *s, char *fn) else if (!strcmp(compinsert, "auto") || !strcmp(compinsert, "automenu")) useline = 1, usemenu = 2; + else if (!strcmp(compinsert, "all")) + useline = 2, usemenu = 0; else if (idigit(*compinsert)) { char *m; |