Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: Re: 3.1.5++ completion listing problem
- X-seq: zsh-workers 4767
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxxx
- Subject: PATCH: Re: 3.1.5++ completion listing problem
- Date: Mon, 14 Dec 1998 10:17:09 +0100 (MET)
- In-reply-to: "Bart Schaefer"'s message of Sat, 12 Dec 1998 07:55:59 -0800
Bart Schaefer wrote:
> ...
>
> I'd suggest simply deleting the "if (smatches < 2)" block, but perhaps
> Sven can tell us what side-effect that may have elsewhere?
The problem with simply removing the test is that the completion code
may now produce multiple matches for which only one would have to be
listed and in this case the matched string would be inserted and
AUTO_LIST would show the `list of matches' (i.e. one string).
But by moving the test up into do_ambiguous() this should be fixed.
The patch below also fixes a problem with lists for multiple groups of
matches taht sometimes caused ALWAYS_LAST_PROMPT to move the cursor up
to the wrong line.
Bye
Sven
P.S.: The hunks will apply with an offset, never mind...
*** os/Zle/zle_tricky.c Wed Dec 9 15:45:46 1998
--- Src/Zle/zle_tricky.c Mon Dec 14 10:08:14 1998
***************
*** 4890,4896 ****
* if it is needed. */
if (isset(LISTBEEP))
feep();
! if (isset(AUTOLIST) && !amenu && !showinglist)
showinglist = -2;
if (am)
lastambig = 1;
--- 5061,5067 ----
* if it is needed. */
if (isset(LISTBEEP))
feep();
! if (isset(AUTOLIST) && !amenu && !showinglist && smatches >= 2)
showinglist = -2;
if (am)
lastambig = 1;
***************
*** 5211,5224 ****
Cmgroup g;
Cmatch *p, m;
Cexpl *e;
! int nlines = 0, ncols, colsz, ngr = 0, nlist = 0, longest = 1, pnl = 0;
int of = isset(LISTTYPES), opl = 0;
int listmax = getiparam("LISTMAX");
- if (smatches < 2) {
- showinglist = 0;
- return;
- }
#ifdef DEBUG
/* Sanity check */
if(!validlist) {
--- 5382,5391 ----
Cmgroup g;
Cmatch *p, m;
Cexpl *e;
! int nlines = 0, ncols, nlist = 0, longest = 1, pnl = 0;
int of = isset(LISTTYPES), opl = 0;
int listmax = getiparam("LISTMAX");
#ifdef DEBUG
/* Sanity check */
if(!validlist) {
***************
*** 5288,5303 ****
e++;
}
}
- if (g->lcount)
- ngr++;
}
longest += 2 + of;
if ((ncols = (columns + 1) / longest)) {
! colsz = (nlist + ncols - 1) / ncols;
! nlines += ngr - 1 + colsz + (nlist == 0);
} else {
ncols = 1;
- colsz = 1;
opl = 1;
for (g = amatches; g; g = g->next) {
char **pp = g->ylist;
--- 5455,5467 ----
e++;
}
}
}
longest += 2 + of;
if ((ncols = (columns + 1) / longest)) {
! for (g = amatches; g; g = g->next)
! nlines += (g->lcount + ncols - 1) / ncols;
} else {
ncols = 1;
opl = 1;
for (g = amatches; g; g = g->next) {
char **pp = g->ylist;
***************
*** 5374,5385 ****
}
}
else {
! int n = g->lcount, nl = (n + ncols - 1) / ncols, i, a;
! int nc = (opl ? 1 : (n + colsz - 1) / colsz);
char **pq;
while (n && nl--) {
! i = nc;
pq = pp;
while (n && i--) {
if (pq - g->ylist >= g->lcount)
--- 5538,5548 ----
}
}
else {
! int n = g->lcount, nl = (n + ncols - 1) / ncols, nc = nl, i, a;
char **pq;
while (n && nl--) {
! i = ncols;
pq = pp;
while (n && i--) {
if (pq - g->ylist >= g->lcount)
***************
*** 5390,5396 ****
while (a--)
putc(' ', shout);
}
! pq += colsz;
n--;
}
if (n)
--- 5553,5559 ----
while (a--)
putc(' ', shout);
}
! pq += nc;
n--;
}
if (n)
***************
*** 5400,5407 ****
}
}
else if (g->lcount) {
! int n = g->lcount, nl = (n + ncols - 1) / ncols, i, j, a;
! int nc = (opl ? 1 : (n + colsz - 1) / colsz);
Cmatch *q;
if (n && pnl) {
--- 5563,5569 ----
}
}
else if (g->lcount) {
! int n = g->lcount, nl = (n + ncols - 1) / ncols, nc = nl, i, j, a;
Cmatch *q;
if (n && pnl) {
***************
*** 5409,5415 ****
pnl = 0;
}
for (p = skipnolist(g->matches); n && nl--;) {
! i = nc;
q = p;
while (n && i--) {
if (!(m = *q))
--- 5571,5577 ----
pnl = 0;
}
for (p = skipnolist(g->matches); n && nl--;) {
! i = ncols;
q = p;
while (n && i--) {
if (!(m = *q))
***************
*** 5438,5444 ****
while (a--)
putc(' ', shout);
if (--n)
! for (j = colsz; j && *q; j--)
q = skipnolist(q + 1);
}
if (n) {
--- 5600,5606 ----
while (a--)
putc(' ', shout);
if (--n)
! for (j = nc; j && *q; j--)
q = skipnolist(q + 1);
}
if (n) {
--
Sven Wischnowsky wischnow@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author