zsh-workers
 help / color / mirror / code / Atom feed
* Prompt oddity when running as "sh" (4.3.0-dev)
@ 2005-09-20 16:00 Bart Schaefer
  2005-09-20 16:30 ` Wayne Davison
  0 siblings, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 2005-09-20 16:00 UTC (permalink / raw)
  To: zsh-workers

schaefer[541] ARGV0=sh Src/zsh -f
%B%S#%s%b
$ 

It would appear that the end-of-line marker for promptcr needs to be
handled differently when running as "sh".


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Prompt oddity when running as "sh" (4.3.0-dev)
  2005-09-20 16:00 Prompt oddity when running as "sh" (4.3.0-dev) Bart Schaefer
@ 2005-09-20 16:30 ` Wayne Davison
  2005-09-21  2:11   ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Wayne Davison @ 2005-09-20 16:30 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-workers

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Prompt oddity when running as "sh" (4.3.0-dev)
  2005-09-20 16:30 ` Wayne Davison
@ 2005-09-21  2:11   ` Bart Schaefer
  2005-09-21  3:42     ` Wayne Davison
  0 siblings, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 2005-09-21  2:11 UTC (permalink / raw)
  To: zsh-workers

On Sep 20,  9:30am, Wayne Davison wrote:
}
} The attached patch makes sure that PROMPT_PERCENT is enabled when the
} PROMPT_SP code wants to expand its end-of-line string.

[...]

} +	str = promptexpand("%B%S#%s%b", 0, NULL, NULL);

Shouldn't that be "%B%S%#%s%b" ?  (That was my original suggestion, in
any event.)            ^^

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

I'd be OK with disabling them in "sh" emulation, but let's hear some more
opinions.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Prompt oddity when running as "sh" (4.3.0-dev)
  2005-09-21  2:11   ` Bart Schaefer
@ 2005-09-21  3:42     ` Wayne Davison
  2005-09-22  8:29       ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Wayne Davison @ 2005-09-21  3:42 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-workers

On Wed, Sep 21, 2005 at 02:11:10AM +0000, Bart Schaefer wrote:
> Shouldn't that be "%B%S%#%s%b" ?  (That was my original suggestion, in
> any event.)            ^^

I'm not sure why we'd want the character to change between % and #
depending on the user being root.  What was your reasoning?

..wayne..


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Prompt oddity when running as "sh" (4.3.0-dev)
  2005-09-21  3:42     ` Wayne Davison
@ 2005-09-22  8:29       ` Bart Schaefer
  0 siblings, 0 replies; 5+ messages in thread
From: Bart Schaefer @ 2005-09-22  8:29 UTC (permalink / raw)
  To: zsh-workers

On Sep 20,  8:42pm, Wayne Davison wrote:
} Subject: Re: Prompt oddity when running as "sh" (4.3.0-dev)
}
} On Wed, Sep 21, 2005 at 02:11:10AM +0000, Bart Schaefer wrote:
} > Shouldn't that be "%B%S%#%s%b" ?
} 
} I'm not sure why we'd want the character to change between % and #
} depending on the user being root.  What was your reasoning?

That it would be the default prompt character, as if zsh had printed
a prompt at the end of the "partial" line and then printed a newline
and a new prompt.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-09-22  8:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-20 16:00 Prompt oddity when running as "sh" (4.3.0-dev) Bart Schaefer
2005-09-20 16:30 ` Wayne Davison
2005-09-21  2:11   ` Bart Schaefer
2005-09-21  3:42     ` Wayne Davison
2005-09-22  8:29       ` Bart Schaefer

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