1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-01-21 12:11:26 +01:00

26270: allow accept-and-menu-complete work with _vallues as well

This commit is contained in:
Andrey Borzenkov 2009-01-09 20:54:35 +00:00
parent 369a03d09f
commit 1a43616975
5 changed files with 27 additions and 13 deletions

View file

@ -10,6 +10,13 @@
2009-01-09 Andrey Borzenkov <bor@zsh.org>
* 26270: Completion/Base/Utility/_values, Doc/Zsh/compwid.yo,
Src/Zle/compcore.c, Src/Zle/complete.c, Src/Zle/compresult.c:
allow accept-and-menu-complete to work also with _values.
Add compstate[list_in_word] flag to control, whether suffix
is replaced by space; when set, next match is added in the same
word.
* unposted: Completion/Mandriva/Command/.distfiles,
Completion/Mandriva/Command/_rebootin: add _rebootin completion
from Mandriva RPM (modified to allow spaces in GRUB menu titles)
@ -10879,5 +10886,5 @@
*****************************************************
* This is used by the shell to define $ZSH_PATCHLEVEL
* $Revision: 1.4499 $
* $Revision: 1.4500 $
*****************************************************

View file

@ -12,6 +12,8 @@ if compvalues -i "$@"; then
local noargs args opts descr action expl sep argsep subc test='*'
local oldcontext="$curcontext"
compstate[list_in_word]=1
compvalues -S argsep
compvalues -s sep && [[ -n "$sep" ]] && test="[^${(q)sep}]#"

View file

@ -325,6 +325,7 @@ do_completion(UNUSED(Hookdef dummy), Compldat dat)
comppatinsert = ztrdup("menu");
forcelist = 0;
haspattern = 0;
complistinword = 0;
complistmax = getiparam("LISTMAX");
zsfree(complastprompt);
complastprompt = ztrdup(((isset(ALWAYSLASTPROMPT) && zmult == 1) ||

View file

@ -38,6 +38,7 @@ zlong compcurrent,
complistmax;
/**/
zlong complistlines,
complistinword,
compignored;
/**/
@ -1146,6 +1147,7 @@ static struct compparam compkparams[] = {
GSU(unambig_pos_gsu) },
{ "insert_positions", PM_SCALAR | PM_READONLY, NULL,
GSU(insert_pos_gsu) },
{ "list_in_word", PM_INTEGER, VAL(complistinword), NULL },
{ "list_max", PM_INTEGER, VAL(complistmax), NULL },
{ "last_prompt", PM_SCALAR, VAL(complastprompt), NULL },
{ "to_end", PM_SCALAR, VAL(comptoend), NULL },
@ -1596,7 +1598,7 @@ setup_(UNUSED(Module m))
compvared = compqstack = NULL;
complastprefix = ztrdup("");
complastsuffix = ztrdup("");
complistmax = 0;
complistmax = complistinword = 0;
hascompmod = 1;
return 0;

View file

@ -1309,21 +1309,23 @@ accept_last(void)
lastbrbeg->str[l] = ',';
lastbrbeg->str[l + 1] = '\0';
} else {
int l;
zlemetacs = minfo.pos + minfo.len + minfo.insc;
iremovesuffix(' ', 1);
l = zlemetacs;
zlemetacs = minfo.pos + minfo.len + minfo.insc - (*(minfo.cur))->qisl;
if (zlemetacs < l)
foredel(l - zlemetacs, CUT_RAW);
else if (zlemetacs > zlemetall)
zlemetacs = zlemetall;
inststrlen(" ", 1, 1);
if (!complistinword) {
int l;
iremovesuffix(' ', 1);
l = zlemetacs;
zlemetacs = minfo.pos + minfo.len + minfo.insc - (*(minfo.cur))->qisl;
if (zlemetacs < l)
foredel(l - zlemetacs, CUT_RAW);
else if (zlemetacs > zlemetall)
zlemetacs = zlemetall;
inststrlen(" ", 1, 1);
}
minfo.insc = minfo.len = 0;
minfo.pos = zlemetacs;
minfo.we = 1;
}
}
if (!wasmeta)
unmetafy_line();