Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Prompt oddity when running as "sh" (4.3.0-dev)



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


Messages sorted by: Reverse Date, Date, Thread, Author