From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12030 invoked from network); 20 Sep 2005 16:31:00 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 20 Sep 2005 16:31:00 -0000 Received: (qmail 10093 invoked from network); 20 Sep 2005 16:30:55 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 20 Sep 2005 16:30:55 -0000 Received: (qmail 28148 invoked by alias); 20 Sep 2005 16:30:50 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 21739 Received: (qmail 28137 invoked from network); 20 Sep 2005 16:30:50 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 20 Sep 2005 16:30:50 -0000 Received: (qmail 9808 invoked from network); 20 Sep 2005 16:30:50 -0000 Received: from dsl3-63-249-88-2.cruzio.com (HELO dot.blorf.net) (63.249.88.2) by a.mx.sunsite.dk with SMTP; 20 Sep 2005 16:30:48 -0000 Received: by dot.blorf.net (Postfix, from userid 1000) id A27AC8D9F; Tue, 20 Sep 2005 09:30:45 -0700 (PDT) Date: Tue, 20 Sep 2005 09:30:45 -0700 From: Wayne Davison To: Bart Schaefer Cc: zsh-workers@sunsite.dk Subject: Re: Prompt oddity when running as "sh" (4.3.0-dev) Message-ID: <20050920163045.GE28681@blorf.net> References: <1050920160050.ZM9532@candle.brasslantern.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="JP+T4n/bALQSJXh8" Content-Disposition: inline In-Reply-To: <1050920160050.ZM9532@candle.brasslantern.com> User-Agent: Mutt/1.5.9i X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.0.4 --JP+T4n/bALQSJXh8 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Sep 20, 2005 at 04:00:50PM +0000, Bart Schaefer wrote: > It would appear that the end-of-line marker for promptcr needs to be > handled differently when running as "sh". The attached patch makes sure that PROMPT_PERCENT is enabled when the PROMPT_SP code wants to expand its end-of-line string. I also wonder if we want PROMPT_SP (and even PROMPT_CR) set when running as "sh". They are both currently enabled by default in all modes. ..wayne.. --JP+T4n/bALQSJXh8 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="promptsp.patch" --- Src/utils.c 20 Sep 2005 15:41:23 -0000 1.93 +++ Src/utils.c 20 Sep 2005 16:24:38 -0000 @@ -758,7 +758,11 @@ preprompt(void) /* The PROMPT_SP heuristic will move the prompt down to a new line * if there was any dangling output on the line (assuming the terminal * has automatic margins, but we try even if hasam isn't set). */ - char *str = promptexpand("%B%S#%s%b", 0, NULL, NULL); + char *str; + int percents = isset(PROMPTPERCENT); + opts[PROMPTPERCENT] = 1; + str = promptexpand("%B%S#%s%b", 0, NULL, NULL); + opts[PROMPTPERCENT] = percents; fprintf(shout, "%s%*s\r", str, (int)columns - 1 - !hasxn, ""); free(str); } --JP+T4n/bALQSJXh8--