From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29005 invoked from network); 28 May 2001 11:41:01 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 28 May 2001 11:41:01 -0000 Received: (qmail 14300 invoked by alias); 28 May 2001 11:40:54 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 14507 Received: (qmail 14278 invoked from network); 28 May 2001 11:40:53 -0000 From: Sven Wischnowsky Date: Mon, 28 May 2001 13:39:59 +0200 (MET DST) Message-Id: <200105281139.NAA08249@beta.informatik.hu-berlin.de> To: zsh-workers@sunsite.dk Subject: Re: compctl -y problem. In-Reply-To: <1010525151112.ZM14441@candle.brasslantern.com> Bart Schaefer wrote: > ... > > I know Sven won't be thrilled about being asked to fix anything in the > old compctl code ... Indeed, though the patch below seems to fix it for me. > perhaps we should just remove the `-y' option, as > it's new since 3.0 anyway, I think I suggested this some time ago. It would be really nice because currently it's the biggest piece of code dangling in the base completion code (`complete' module) that's specific to compctl. > and document the correct way to achieve the > same effect by using the new completion system (which, incidentally, I > don't know how to do ... `compadd -d' doesn't quite cut it). You already mentioned `compadd -ld' in another mail. I prefer this a lot because there we have a one-to-one correspondence between matches and strings to display, meaning that things like menu selection work properly. If there are other strings one want to have displayed together with the list one can always use `compadd -X' or `compadd -x'. Bye Sven Index: Src/Zle/compresult.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/compresult.c,v retrieving revision 1.36 diff -u -r1.36 compresult.c --- Src/Zle/compresult.c 2001/03/27 09:14:52 1.36 +++ Src/Zle/compresult.c 2001/05/28 11:40:13 @@ -1398,9 +1398,12 @@ if (!onlyexpl && pp) { /* We have an ylist, lets see, if it contains newlines. */ hidden = 1; - while (!nl && *pp) - nl = !!strchr(*pp++, '\n'); - + while (!nl && *pp) { + if (ztrlen(*pp) >= columns) + nl = 1; + else + nl = !!strchr(*pp++, '\n'); + } pp = g->ylist; if (nl || !pp[1]) { /* Yup, there are newlines, count lines. */ @@ -1411,17 +1414,17 @@ while ((sptr = *pp)) { while (sptr && *sptr) { nlines += (nlptr = strchr(sptr, '\n')) - ? 1 + (nlptr-sptr) / columns - : strlen(sptr) / columns; + ? 1 + (nlptr - sptr - 1) / columns + : (ztrlen(sptr) - 1) / columns; sptr = nlptr ? nlptr+1 : NULL; } nlines++; pp++; } - nlines--; + /*** nlines--; */ } else { while (*pp) { - l = strlen(*pp); + l = ztrlen(*pp); ndisp++; if (l > glong) glong = l; @@ -1524,7 +1527,7 @@ g->width = 1; while (*pp) - glines += 1 + (strlen(*pp++) / columns); + glines += 1 + (ztrlen(*pp++) / columns); } } } else { @@ -1566,7 +1569,7 @@ VARARR(int, ylens, yl); for (i = 0; *pp; i++, pp++) - ylens[i] = strlen(*pp) + add; + ylens[i] = ztrlen(*pp) + add; if (g->flags & CGF_ROWS) { int count, tcol, first, maxlines = 0, llines; @@ -1913,10 +1916,16 @@ } } if (g->flags & CGF_LINES) { - while (*pp) { - zputs(*pp, shout); - if (*++pp) - putc('\n', shout); + char *p; + + while ((p = *pp++)) { + zputs(p, shout); + if (*pp) { + if (ztrlen(p) % columns) + putc('\n', shout); + else + fputs(" \010", shout); + } } } else { int n = g->lcount, nl, nc, i, a; -- Sven Wischnowsky wischnow@informatik.hu-berlin.de