From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 752 invoked from network); 27 Jul 2004 21:52:41 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 27 Jul 2004 21:52:41 -0000 Received: (qmail 2451 invoked from network); 27 Jul 2004 21:52:30 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 27 Jul 2004 21:52:30 -0000 Received: (qmail 24167 invoked by alias); 27 Jul 2004 21:51:11 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 20201 Received: (qmail 24157 invoked from network); 27 Jul 2004 21:51:11 -0000 Received: from unknown (HELO a.mx.sunsite.dk) (130.225.247.88) by 130.225.247.90 with SMTP; 27 Jul 2004 21:51:11 -0000 Received: (qmail 86747 invoked from network); 27 Jul 2004 21:19:53 -0000 Received: from lhuumrelay3.lnd.ops.eu.uu.net (62.189.58.19) by a.mx.sunsite.dk with SMTP; 27 Jul 2004 21:19:50 -0000 Received: from MAILSWEEPER01.csr.com (mailhost1.csr.com [62.189.183.235]) by lhuumrelay3.lnd.ops.eu.uu.net (8.11.0/8.11.0) with ESMTP id i6R9J5v02293 for ; Tue, 27 Jul 2004 09:19:06 GMT Received: from EXCHANGE02.csr.com (unverified [192.168.137.45]) by MAILSWEEPER01.csr.com (Content Technologies SMTPRS 4.3.12) with ESMTP id ; Tue, 27 Jul 2004 10:18:18 +0100 Received: from news01.csr.com ([192.168.143.38]) by EXCHANGE02.csr.com with Microsoft SMTPSVC(5.0.2195.6713); Tue, 27 Jul 2004 10:20:52 +0100 Received: from news01.csr.com (localhost.localdomain [127.0.0.1]) by news01.csr.com (8.12.11/8.12.11) with ESMTP id i6R9J1kt013296; Tue, 27 Jul 2004 10:19:01 +0100 Received: from csr.com (pws@localhost) by news01.csr.com (8.12.11/8.12.11/Submit) with ESMTP id i6R9Iw0m013293; Tue, 27 Jul 2004 10:18:58 +0100 Message-Id: <200407270918.i6R9Iw0m013293@news01.csr.com> X-Authentication-Warning: news01.csr.com: pws owned process doing -bs To: zsh-workers@sunsite.dk, 201685-forwarded@bugs.debian.org Subject: Re: Bug#201685: zsh: bug in prompt expansion In-reply-to: "Clint Adams"'s message of "Fri, 23 Jul 2004 13:33:22 EDT." <20040723173322.GA9988@scowler.net> Date: Tue, 27 Jul 2004 10:18:58 +0100 From: Peter Stephenson X-OriginalArrivalTime: 27 Jul 2004 09:20:52.0793 (UTC) FILETIME=[037EB290:01C473BB] X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=-4.9 required=6.0 tests=BAYES_00 autolearn=no version=2.63 X-Spam-Hits: -4.9 Clint Adams wrote: > I don't remember if this was discussed before. > > On Thu, Jul 17, 2003 at 11:33:11AM +0200, Martin Godisch wrote: > > > > After PROMPT='%~%1(C./.) ' the full prompt should be `/ ' in the root > > directory, because the absolute path `/' does not have at least one element I sent a patch for this but can't see any sign of it having got anywhere. This should do what was asked for. It's more logical but I don't know if anyone out there is expecting the code simply to count slashes. Index: Doc/Zsh/prompt.yo =================================================================== RCS file: /cvsroot/zsh/zsh/Doc/Zsh/prompt.yo,v retrieving revision 1.6 diff -u -r1.6 prompt.yo --- Doc/Zsh/prompt.yo 2 Nov 2001 12:35:32 -0000 1.6 +++ Doc/Zsh/prompt.yo 26 Jul 2004 17:12:13 -0000 @@ -217,11 +217,13 @@ sitem(tt(?))(True if the exit status of the last command was var(n).) sitem(tt(_))(True if at least var(n) shell constructs were started.) sxitem(tt(C)) -sitem(tt(/))(True if the current absolute path has at least var(n) elements.) +sitem(tt(/))(True if the current absolute path has at least var(n) elements +relative to the root directory, hence tt(/) is counted as 0 elements.) sxitem(tt(c)) sxitem(tt(.)) sitem(tt(~))(True if the current path, with prefix replacement, has at -least var(n) elements.) +least var(n) elements relative to the root directory, hence tt(/) is +counted as 0 elements.) sitem(tt(D))(True if the month is equal to var(n) (January = 0).) sitem(tt(d))(True if the day of the month is equal to var(n).) sitem(tt(g))(True if the effective gid of the current process is var(n).) Index: Src/prompt.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/prompt.c,v retrieving revision 1.19 diff -u -r1.19 prompt.c --- Src/prompt.c 22 Jun 2004 13:10:02 -0000 1.19 +++ Src/prompt.c 26 Jul 2004 17:12:14 -0000 @@ -244,9 +244,12 @@ if ((nd = finddir(ss))) { arg--; ss += strlen(nd->dir); - } + } /*FALLTHROUGH*/ case '/': case 'C': + /* `/' gives 0, `/any' gives 1, etc. */ + if (*ss++ == '/' && *ss) + arg--; for (; *ss; ss++) if (*ss == '/') arg--; -- Peter Stephenson Software Engineer CSR Ltd., Science Park, Milton Road, Cambridge, CB4 0WH, UK Tel: +44 (0)1223 692070 ********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com **********************************************************************