zsh-workers
 help / color / mirror / code / Atom feed
From: Wayne Davison <wayned@users.sourceforge.net>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: zsh-workers@sunsite.dk
Subject: Re: Prompt oddity when running as "sh" (4.3.0-dev)
Date: Tue, 20 Sep 2005 09:30:45 -0700	[thread overview]
Message-ID: <20050920163045.GE28681@blorf.net> (raw)
In-Reply-To: <1050920160050.ZM9532@candle.brasslantern.com>

[-- Attachment #1: Type: text/plain, Size: 456 bytes --]

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..

[-- Attachment #2: promptsp.patch --]
[-- Type: text/plain, Size: 642 bytes --]

--- 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);
     }

  reply	other threads:[~2005-09-20 16:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-20 16:00 Bart Schaefer
2005-09-20 16:30 ` Wayne Davison [this message]
2005-09-21  2:11   ` Bart Schaefer
2005-09-21  3:42     ` Wayne Davison
2005-09-22  8:29       ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050920163045.GE28681@blorf.net \
    --to=wayned@users.sourceforge.net \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).