summaryrefslogtreecommitdiff
path: root/Src/Zle/compresult.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/Zle/compresult.c')
-rw-r--r--Src/Zle/compresult.c73
1 files changed, 39 insertions, 34 deletions
diff --git a/Src/Zle/compresult.c b/Src/Zle/compresult.c
index 0389b52a2..f2729a0fe 100644
--- a/Src/Zle/compresult.c
+++ b/Src/Zle/compresult.c
@@ -1473,13 +1473,14 @@ calclist(int showall)
if (lastinvcount == invcount &&
listdat.valid && onlyexpl == listdat.onlyexpl &&
menuacc == listdat.menuacc && showall == listdat.showall &&
- lines == listdat.lines && columns == listdat.columns)
+ zterm_lines == listdat.zterm_lines &&
+ zterm_columns == listdat.zterm_columns)
return 0;
lastinvcount = invcount;
for (g = amatches; g; g = g->next) {
char **pp = g->ylist;
- int nl = 0, l, glong = 1, gshort = columns, ndisp = 0, totl = 0;
+ int nl = 0, l, glong = 1, gshort = zterm_columns, ndisp = 0, totl = 0;
int hasf = 0;
g->flags |= CGF_PACKED | CGF_ROWS;
@@ -1495,7 +1496,7 @@ calclist(int showall)
/* We have an ylist, lets see, if it contains newlines. */
hidden = 1;
while (!nl && *pp) {
- if (MB_METASTRWIDTH(*pp) >= columns)
+ if (MB_METASTRWIDTH(*pp) >= zterm_columns)
nl = 1;
else
nl = !!strchr(*pp++, '\n');
@@ -1511,11 +1512,12 @@ calclist(int showall)
while (*sptr) {
if ((nlptr = strchr(sptr, '\n'))) {
*nlptr = '\0';
- nlines += 1 + (MB_METASTRWIDTH(sptr)-1) / columns;
+ nlines += 1 + (MB_METASTRWIDTH(sptr)-1) /
+ zterm_columns;
*nlptr = '\n';
sptr = nlptr + 1;
} else {
- nlines += (MB_METASTRWIDTH(sptr)-1) / columns;
+ nlines += (MB_METASTRWIDTH(sptr)-1) / zterm_columns;
break;
}
}
@@ -1607,7 +1609,7 @@ calclist(int showall)
g->dcount = ndisp;
g->width = glong + CM_SPACE;
g->shortest = gshort + CM_SPACE;
- if ((g->cols = columns / g->width) > g->dcount)
+ if ((g->cols = zterm_columns / g->width) > g->dcount)
g->cols = g->dcount;
if (g->cols) {
i = g->cols * g->width - CM_SPACE;
@@ -1636,9 +1638,10 @@ calclist(int showall)
} else {
g->cols = 1;
g->width = 1;
-
+
while (*pp)
- glines += 1 + (MB_METASTRWIDTH(*pp++) / columns);
+ glines += 1 + (MB_METASTRWIDTH(*pp++) /
+ zterm_columns);
}
}
} else {
@@ -1650,15 +1653,17 @@ calclist(int showall)
} else if (!(g->flags & CGF_LINES)) {
g->cols = 1;
g->width = 0;
-
+
for (p = g->matches; (m = *p); p++)
if (!(m->flags & CMF_HIDE)) {
if (m->disp) {
if (!(m->flags & CMF_DISPLINE))
- glines += 1 + ((mlens[m->gnum] - 1) / columns);
+ glines += 1 + ((mlens[m->gnum] - 1) /
+ zterm_columns);
} else if (showall ||
!(m->flags & (CMF_NOLIST | CMF_MULT)))
- glines += 1 + (((mlens[m->gnum]) - 1) / columns);
+ glines += 1 + (((mlens[m->gnum]) - 1) /
+ zterm_columns);
}
}
}
@@ -1669,8 +1674,8 @@ calclist(int showall)
if (!(g->flags & CGF_PACKED))
continue;
- ws = g->widths = (int *) zalloc(columns * sizeof(int));
- memset(ws, 0, columns * sizeof(int));
+ ws = g->widths = (int *) zalloc(zterm_columns * sizeof(int));
+ memset(ws, 0, zterm_columns * sizeof(int));
tlines = g->lins;
tcols = g->cols;
width = 0;
@@ -1686,14 +1691,14 @@ calclist(int showall)
if (g->flags & CGF_ROWS) {
int nth, tcol, len;
- for (tcols = columns / (g->shortest + CM_SPACE);
+ for (tcols = zterm_columns / (g->shortest + CM_SPACE);
tcols > g->cols;
tcols--) {
memset(ws, 0, tcols * sizeof(int));
for (width = nth = tcol = 0, tlines = 1;
- width < columns && nth < g->dcount;
+ width < zterm_columns && nth < g->dcount;
nth++, tcol++) {
m = *p;
@@ -1709,13 +1714,13 @@ calclist(int showall)
ws[tcol] = len;
}
}
- if (width < columns)
+ if (width < zterm_columns)
break;
}
} else {
int nth, tcol, tline, len;
- for (tcols = columns / (g->shortest + CM_SPACE);
+ for (tcols = zterm_columns / (g->shortest + CM_SPACE);
tcols > g->cols;
tcols--) {
@@ -1725,7 +1730,7 @@ calclist(int showall)
memset(ws, 0, tcols * sizeof(int));
for (width = nth = tcol = tline = 0;
- width < columns && nth < g->dcount;
+ width < zterm_columns && nth < g->dcount;
nth++, tline++) {
m = *p;
@@ -1745,7 +1750,7 @@ calclist(int showall)
ws[tcol] = len;
}
}
- if (width < columns)
+ if (width < zterm_columns)
break;
}
}
@@ -1754,7 +1759,7 @@ calclist(int showall)
if (g->flags & CGF_ROWS) {
int nth, tcol, len;
- for (tcols = columns / (g->shortest + CM_SPACE);
+ for (tcols = zterm_columns / (g->shortest + CM_SPACE);
tcols > g->cols;
tcols--) {
@@ -1762,7 +1767,7 @@ calclist(int showall)
for (width = nth = tcol = 0, tlines = 1,
p = skipnolist(g->matches, showall);
- *p && width < columns && nth < g->dcount;
+ *p && width < zterm_columns && nth < g->dcount;
nth++, p = skipnolist(p + 1, showall), tcol++) {
m = *p;
@@ -1779,13 +1784,13 @@ calclist(int showall)
ws[tcol] = len;
}
}
- if (width < columns)
+ if (width < zterm_columns)
break;
}
} else {
int nth, tcol, tline, len;
- for (tcols = columns / (g->shortest + CM_SPACE);
+ for (tcols = zterm_columns / (g->shortest + CM_SPACE);
tcols > g->cols;
tcols--) {
@@ -1796,7 +1801,7 @@ calclist(int showall)
for (width = nth = tcol = tline = 0,
p = skipnolist(g->matches, showall);
- *p && width < columns && nth < g->dcount;
+ *p && width < zterm_columns && nth < g->dcount;
nth++, p = skipnolist(p + 1, showall), tline++) {
m = *p;
@@ -1817,7 +1822,7 @@ calclist(int showall)
ws[tcol] = len;
}
}
- if (width < columns) {
+ if (width < zterm_columns) {
if (++tcol < tcols)
tcols = tcol;
break;
@@ -1828,7 +1833,7 @@ calclist(int showall)
if (tcols <= g->cols)
tlines = g->lins;
if (tlines == g->lins) {
- zfree(ws, columns * sizeof(int));
+ zfree(ws, zterm_columns * sizeof(int));
g->widths = NULL;
} else {
nlines += tlines - g->lins;
@@ -1862,8 +1867,8 @@ calclist(int showall)
listdat.nlines = nlines;
listdat.menuacc = menuacc;
listdat.onlyexpl = onlyexpl;
- listdat.columns = columns;
- listdat.lines = lines;
+ listdat.zterm_columns = zterm_columns;
+ listdat.zterm_lines = zterm_lines;
listdat.showall = showall;
return 1;
@@ -1884,7 +1889,7 @@ asklist(void)
if ((!minfo.cur || !minfo.asked) &&
((complistmax > 0 && listdat.nlist >= complistmax) ||
(complistmax < 0 && listdat.nlines <= -complistmax) ||
- (!complistmax && listdat.nlines >= lines))) {
+ (!complistmax && listdat.nlines >= zterm_lines))) {
int qup, l;
zsetterm();
@@ -1893,7 +1898,7 @@ asklist(void)
listdat.nlist, listdat.nlines) :
fprintf(shout, "zsh: do you wish to see all %d lines? ",
listdat.nlines));
- qup = ((l + columns - 1) / columns) - 1;
+ qup = ((l + zterm_columns - 1) / zterm_columns) - 1;
fflush(shout);
if (!getzlequery()) {
if (clearflag) {
@@ -1987,7 +1992,7 @@ printlist(int over, CLPrintFunc printm, int showall)
while ((p = *pp++)) {
zputs(p, shout);
if (*pp) {
- if (MB_METASTRWIDTH(p) % columns)
+ if (MB_METASTRWIDTH(p) % zterm_columns)
putc('\n', shout);
else
fputs(" \010", shout);
@@ -2113,7 +2118,7 @@ printlist(int over, CLPrintFunc printm, int showall)
if (clearflag) {
/* Move the cursor up to the prompt, if always_last_prompt *
* is set and all that... */
- if ((ml = listdat.nlines + nlnct - 1) < lines) {
+ if ((ml = listdat.nlines + nlnct - 1) < zterm_lines) {
tcmultout(TCUP, TCMULTUP, ml);
showinglist = -1;
@@ -2134,8 +2139,8 @@ bld_all_str(Cmatch all)
{
Cmgroup g;
Cmatch *mp, m;
- int len = columns - 5, t, add = 0;
- VARARR(char, buf, columns + 1);
+ int len = zterm_columns - 5, t, add = 0;
+ VARARR(char, buf, zterm_columns + 1);
buf[0] = '\0';