summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Src/utils.c9
1 files changed, 9 insertions, 0 deletions
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);