From cbdcd62b385dea028b5312a979a3420c6fa15f98 Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Tue, 26 Jul 2005 22:50:49 +0000 Subject: Moved the PROMPT_SP output into preprompt() so that it takes effect prior to things like precmd(), the mail-check output, etc. --- Src/utils.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Src/utils.c b/Src/utils.c index 19d022c1e..e8de8d5af 100644 --- a/Src/utils.c +++ b/Src/utils.c @@ -693,6 +693,15 @@ preprompt(void) if (errflag) return; + if (isset(PROMPTSP) && isset(PROMPTCR)) { + /* 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); + fprintf(shout, "%s%*s\r", str, (int)columns - 1 - !hasxn, ""); + free(str); + } + /* If a shell function named "precmd" exists, * * then execute it. */ callhookfunc("precmd", NULL); -- cgit 1.4.1