From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20163 invoked from network); 29 Mar 2007 21:27:56 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.8 (2007-02-13) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,FORGED_RCVD_HELO autolearn=ham version=3.1.8 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 29 Mar 2007 21:27:56 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 9860 invoked from network); 29 Mar 2007 21:27:50 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 29 Mar 2007 21:27:50 -0000 Received: (qmail 18516 invoked by alias); 29 Mar 2007 21:27:47 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 23248 Received: (qmail 18506 invoked from network); 29 Mar 2007 21:27:47 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 29 Mar 2007 21:27:47 -0000 Received: (qmail 9488 invoked from network); 29 Mar 2007 21:27:47 -0000 Received: from mtaout03-winn.ispmail.ntl.com (81.103.221.49) by a.mx.sunsite.dk with SMTP; 29 Mar 2007 21:27:43 -0000 Received: from aamtaout04-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout03-winn.ispmail.ntl.com with ESMTP id <20070329212741.STNR1468.mtaout03-winn.ispmail.ntl.com@aamtaout04-winn.ispmail.ntl.com> for ; Thu, 29 Mar 2007 22:27:41 +0100 Received: from pwslaptop.csr.com ([81.107.47.85]) by aamtaout04-winn.ispmail.ntl.com with SMTP id <20070329212741.CUJM29112.aamtaout04-winn.ispmail.ntl.com@pwslaptop.csr.com> for ; Thu, 29 Mar 2007 22:27:41 +0100 Date: Thu, 29 Mar 2007 22:25:03 +0100 From: Peter Stephenson To: Zsh hackers list Subject: Re: completion after < at the start of the line Message-Id: <20070329222503.2b920aa4.p.w.stephenson@ntlworld.com> In-Reply-To: <20070328222525.e4cf0654.p.w.stephenson@ntlworld.com> References: <20070327213726.GF4885@sc.homeunix.net> <20070328152955.8a64af07.pws@csr.com> <20070328222525.e4cf0654.p.w.stephenson@ntlworld.com> X-Mailer: Sylpheed version 2.2.10 (GTK+ 2.10.8; i386-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Wed, 28 Mar 2007 22:25:25 +0100 Peter Stephenson wrote: > I've been seeing something screwy to do with the complist module when > trying this. It doesn't seem to be related; it happens with or without > an initial redirection, but I happened to fall over it when testing > this. I've been getting it with "ls --" with menu selection turned > on. I think I've tracked this down after a couple of hours of frustration: if the last line in a completion list was just short of the width, complist() turned off printing early, but didn't increment over the character it wasn't printing, which could be just enough to force the string to need an extra line. This was quite a special case. I added some extra debugging aids to help track this down; in particular, if zsh is compiled with debugging, ZSH_DEBUG_LOG can be used to give a file to which dputs output is appended. I've left this in. Index: INSTALL =================================================================== RCS file: /cvsroot/zsh/zsh/INSTALL,v retrieving revision 1.28 diff -u -r1.28 INSTALL --- INSTALL 1 Nov 2006 12:25:21 -0000 1.28 +++ INSTALL 29 Mar 2007 21:18:14 -0000 @@ -326,6 +326,9 @@ To add some sanity checks and generate debugging information for debuggers you can use the following option. This also disables optimization. --enable-zsh-debug # use it if you want to debug zsh +In this mode, zsh may output extra information about internal errors +to stderr. The shell variable ZSH_DEBUG_LOG may be set to another file +to which errors will be appended. Startup/shutdown files ---------------------- Index: Src/utils.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/utils.c,v retrieving revision 1.159 diff -u -r1.159 utils.c --- Src/utils.c 26 Feb 2007 18:47:25 -0000 1.159 +++ Src/utils.c 29 Mar 2007 21:18:16 -0000 @@ -129,7 +129,7 @@ fputc((unsigned char)':', stderr); } - zerrmsg(fmt, ap); + zerrmsg(stderr, fmt, ap); } @@ -218,14 +218,20 @@ dputs(VA_ALIST1(const char *message)) VA_DCL { + char *filename; + FILE *file; va_list ap; VA_DEF_ARG(const char *message); VA_START(ap, message); VA_GET_ARG(ap, message, const char *); - zerrmsg(message, ap); + if ((filename = getsparam("ZSH_DEBUG_LOG")) != NULL && + (file = fopen(filename, "a")) != NULL) { + zerrmsg(file, message, ap); + fclose(file); + } else + zerrmsg(stderr, message, ap); va_end(ap); - fflush(stderr); } #endif /* DEBUG */ @@ -245,15 +251,15 @@ /**/ void -zerrmsg(const char *fmt, va_list ap) +zerrmsg(FILE *file, const char *fmt, va_list ap) { const char *str; int num; if ((unset(SHINSTDIN) || locallevel) && lineno) - fprintf(stderr, "%ld: ", (long)lineno); + fprintf(file, "%ld: ", (long)lineno); else - fputc((unsigned char)' ', stderr); + fputc((unsigned char)' ', file); while (*fmt) if (*fmt == '%') { @@ -261,7 +267,7 @@ switch (*fmt++) { case 's': str = va_arg(ap, const char *); - nicezputs(str, stderr); + nicezputs(str, file); break; case 'l': { char *s; @@ -271,50 +277,50 @@ s = zhalloc(num + 1); memcpy(s, str, num); s[num] = '\0'; - nicezputs(s, stderr); + nicezputs(s, file); break; } case 'd': num = va_arg(ap, int); - fprintf(stderr, "%d", num); + fprintf(file, "%d", num); break; case '%': - putc('%', stderr); + putc('%', file); break; case 'c': num = va_arg(ap, int); #ifdef MULTIBYTE_SUPPORT mb_metacharinit(); - zputs(wcs_nicechar(num, NULL, NULL), stderr); + zputs(wcs_nicechar(num, NULL, NULL), file); #else - zputs(nicechar(num), stderr); + zputs(nicechar(num), file); #endif break; case 'e': /* print the corresponding message for this errno */ num = va_arg(ap, int); if (num == EINTR) { - fputs("interrupt\n", stderr); + fputs("interrupt\n", file); errflag = 1; return; } /* If the message is not about I/O problems, it looks better * * if we uncapitalize the first letter of the message */ if (num == EIO) - fputs(strerror(num), stderr); + fputs(strerror(num), file); else { char *errmsg = strerror(num); - fputc(tulower(errmsg[0]), stderr); - fputs(errmsg + 1, stderr); + fputc(tulower(errmsg[0]), file); + fputs(errmsg + 1, file); } break; } } else { - putc(*fmt == Meta ? *++fmt ^ 32 : *fmt, stderr); + putc(*fmt == Meta ? *++fmt ^ 32 : *fmt, file); fmt++; } - putc('\n', stderr); - fflush(stderr); + putc('\n', file); + fflush(file); } /* Output a single character, for the termcap routines. * Index: Src/zsh.h =================================================================== RCS file: /cvsroot/zsh/zsh/Src/zsh.h,v retrieving revision 1.111 diff -u -r1.111 zsh.h --- Src/zsh.h 19 Mar 2007 12:21:55 -0000 1.111 +++ Src/zsh.h 29 Mar 2007 21:18:17 -0000 @@ -1925,10 +1925,12 @@ # define DPUTS(X,Y) if (!(X)) {;} else dputs(ERRMSG(Y)) # define DPUTS1(X,Y,Z1) if (!(X)) {;} else dputs(ERRMSG(Y), Z1) # define DPUTS2(X,Y,Z1,Z2) if (!(X)) {;} else dputs(ERRMSG(Y), Z1, Z2) +# define DPUTS3(X,Y,Z1,Z2,Z3) if (!(X)) {;} else dputs(ERRMSG(Y), Z1, Z2, Z3) #else # define DPUTS(X,Y) # define DPUTS1(X,Y,Z1) # define DPUTS2(X,Y,Z1,Z2) +# define DPUTS3(X,Y,Z1,Z2,Z3) #endif /**************************/ Index: Src/Zle/complist.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/complist.c,v retrieving revision 1.99 diff -u -r1.99 complist.c --- Src/Zle/complist.c 6 Feb 2007 10:12:20 -0000 1.99 +++ Src/Zle/complist.c 29 Mar 2007 21:18:18 -0000 @@ -1139,6 +1139,10 @@ if (dopr == 1) { if (ml == mlend - 1 && (cc % columns) == columns - 1) { dopr = 0; + if (*p == Meta) + p += 2; + else + p++; continue; } while (len--) { @@ -1580,6 +1584,8 @@ Cmatch m; int len, subcols = 0, stop = 0, ret = 0; + DPUTS2(ml >= mlines, "clprintm called with ml too large (%d/%d)", + ml, mlines); if (g != last_group) *last_cap = '\0'; -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/