mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-11 13:01:28 +02:00
zsh-workers/8205
This commit is contained in:
parent
99ed2ea017
commit
2c8aa1a190
1 changed files with 40 additions and 32 deletions
|
@ -3983,7 +3983,7 @@ addmatches(Cadata dat, char **argv)
|
||||||
char **aign = NULL, **dparr = NULL, oaq = autoq, *oppre = dat->ppre;
|
char **aign = NULL, **dparr = NULL, oaq = autoq, *oppre = dat->ppre;
|
||||||
char *oqp = qipre, *oqs = qisuf, qc, **disp = NULL;
|
char *oqp = qipre, *oqs = qisuf, qc, **disp = NULL;
|
||||||
int lpl, lsl, pl, sl, bpl, bsl, bppl = -1, bssl = -1;
|
int lpl, lsl, pl, sl, bpl, bsl, bppl = -1, bssl = -1;
|
||||||
int llpl = 0, llsl = 0, nm = mnum, gflags;
|
int llpl = 0, llsl = 0, nm = mnum, gflags = 0;
|
||||||
int oisalt = 0, isalt, isexact, doadd, ois = instring, oib = inbackt;
|
int oisalt = 0, isalt, isexact, doadd, ois = instring, oib = inbackt;
|
||||||
Cline lc = NULL;
|
Cline lc = NULL;
|
||||||
Cmatch cm;
|
Cmatch cm;
|
||||||
|
@ -5779,7 +5779,7 @@ makecomplistctl(int flags)
|
||||||
static int
|
static int
|
||||||
makecomplistglobal(char *os, int incmd, int lst, int flags)
|
makecomplistglobal(char *os, int incmd, int lst, int flags)
|
||||||
{
|
{
|
||||||
Compctl cc;
|
Compctl cc = NULL;
|
||||||
char *s;
|
char *s;
|
||||||
|
|
||||||
ccont = CC_CCCONT;
|
ccont = CC_CCCONT;
|
||||||
|
@ -5787,9 +5787,12 @@ makecomplistglobal(char *os, int incmd, int lst, int flags)
|
||||||
|
|
||||||
if (linwhat == IN_ENV) {
|
if (linwhat == IN_ENV) {
|
||||||
/* Default completion for parameter values. */
|
/* Default completion for parameter values. */
|
||||||
|
if (!(flags & CFN_DEFAULT)) {
|
||||||
cc = &cc_default;
|
cc = &cc_default;
|
||||||
keypm = NULL;
|
keypm = NULL;
|
||||||
|
}
|
||||||
} else if (linwhat == IN_MATH) {
|
} else if (linwhat == IN_MATH) {
|
||||||
|
if (!(flags & CFN_DEFAULT)) {
|
||||||
if (insubscr >= 2) {
|
if (insubscr >= 2) {
|
||||||
/* Inside subscript of assoc array, complete keys. */
|
/* Inside subscript of assoc array, complete keys. */
|
||||||
cc_dummy.mask = 0;
|
cc_dummy.mask = 0;
|
||||||
|
@ -5801,10 +5804,12 @@ makecomplistglobal(char *os, int incmd, int lst, int flags)
|
||||||
}
|
}
|
||||||
cc = &cc_dummy;
|
cc = &cc_dummy;
|
||||||
cc_dummy.refc = 10000;
|
cc_dummy.refc = 10000;
|
||||||
|
}
|
||||||
} else if (linwhat == IN_COND) {
|
} else if (linwhat == IN_COND) {
|
||||||
/* We try to be clever here: in conditions we complete option *
|
/* We try to be clever here: in conditions we complete option *
|
||||||
* names after a `-o', file names after `-nt', `-ot', and `-ef' *
|
* names after a `-o', file names after `-nt', `-ot', and `-ef' *
|
||||||
* and file names and parameter names elsewhere. */
|
* and file names and parameter names elsewhere. */
|
||||||
|
if (!(flags & CFN_DEFAULT)) {
|
||||||
s = clwpos ? clwords[clwpos - 1] : "";
|
s = clwpos ? clwords[clwpos - 1] : "";
|
||||||
cc_dummy.mask = !strcmp("-o", s) ? CC_OPTIONS :
|
cc_dummy.mask = !strcmp("-o", s) ? CC_OPTIONS :
|
||||||
((*s == '-' && s[1] && !s[2]) ||
|
((*s == '-' && s[1] && !s[2]) ||
|
||||||
|
@ -5815,10 +5820,13 @@ makecomplistglobal(char *os, int incmd, int lst, int flags)
|
||||||
cc = &cc_dummy;
|
cc = &cc_dummy;
|
||||||
cc_dummy.refc = 10000;
|
cc_dummy.refc = 10000;
|
||||||
keypm = NULL;
|
keypm = NULL;
|
||||||
|
}
|
||||||
} else if (linredir) {
|
} else if (linredir) {
|
||||||
|
if (!(flags & CFN_DEFAULT)) {
|
||||||
/* In redirections use default completion. */
|
/* In redirections use default completion. */
|
||||||
cc = &cc_default;
|
cc = &cc_default;
|
||||||
keypm = NULL;
|
keypm = NULL;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Otherwise get the matches for the command. */
|
/* Otherwise get the matches for the command. */
|
||||||
keypm = NULL;
|
keypm = NULL;
|
||||||
|
@ -6980,7 +6988,7 @@ makecomplistflags(Compctl cc, char *s, int incmd, int compadd)
|
||||||
if (!errflag && cc->ylist) {
|
if (!errflag && cc->ylist) {
|
||||||
/* generate the user-defined display list: if anything fails, *
|
/* generate the user-defined display list: if anything fails, *
|
||||||
* we silently allow the normal completion list to be used. */
|
* we silently allow the normal completion list to be used. */
|
||||||
char **yaptr, *uv = NULL;
|
char **yaptr = NULL, *uv = NULL;
|
||||||
List list;
|
List list;
|
||||||
|
|
||||||
if (cc->ylist[0] == '$' || cc->ylist[0] == '(') {
|
if (cc->ylist[0] == '$' || cc->ylist[0] == '(') {
|
||||||
|
@ -8955,7 +8963,7 @@ calclist(void)
|
||||||
}
|
}
|
||||||
for (g = amatches; g; g = g->next) {
|
for (g = amatches; g; g = g->next) {
|
||||||
if (g->widths) {
|
if (g->widths) {
|
||||||
int *p, a = (max - g->totl - add) / g->cols;
|
int *p, a = (max - g->totl + add) / g->cols;
|
||||||
|
|
||||||
for (i = g->cols, p = g->widths; i; i--, p++)
|
for (i = g->cols, p = g->widths; i; i--, p++)
|
||||||
*p += a;
|
*p += a;
|
||||||
|
@ -9024,7 +9032,7 @@ printlist(int over, CLPrintFunc printm)
|
||||||
Cmatch *p, m;
|
Cmatch *p, m;
|
||||||
Cexpl *e;
|
Cexpl *e;
|
||||||
int pnl = 0, cl = (over ? listdat.nlines : -1);
|
int pnl = 0, cl = (over ? listdat.nlines : -1);
|
||||||
int mc, ml = 0, printed = 0;
|
int mc = 0, ml = 0, printed = 0;
|
||||||
|
|
||||||
if (cl < 2) {
|
if (cl < 2) {
|
||||||
cl = -1;
|
cl = -1;
|
||||||
|
@ -9135,7 +9143,7 @@ printlist(int over, CLPrintFunc printm)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printed++;
|
printed++;
|
||||||
printm(g, p, mc, ml, 1, 0, NULL, NULL);
|
printm(g, p, 0, ml, 1, 0, NULL, NULL);
|
||||||
pnl = 1;
|
pnl = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9183,7 +9191,7 @@ printlist(int over, CLPrintFunc printm)
|
||||||
mc++;
|
mc++;
|
||||||
}
|
}
|
||||||
while (i-- > 0)
|
while (i-- > 0)
|
||||||
printm(g, NULL, mc, ml, (!i),
|
printm(g, NULL, mc++, ml, (!i),
|
||||||
(g->widths ? g->widths[mc] : g->width), NULL, NULL);
|
(g->widths ? g->widths[mc] : g->width), NULL, NULL);
|
||||||
|
|
||||||
if (n) {
|
if (n) {
|
||||||
|
|
Loading…
Reference in a new issue