about summary refs log tree commit diff
diff options
context:
space:
mode:
authorWayne Davison <wayned@users.sourceforge.net>2005-07-26 22:50:49 +0000
committerWayne Davison <wayned@users.sourceforge.net>2005-07-26 22:50:49 +0000
commitcbdcd62b385dea028b5312a979a3420c6fa15f98 (patch)
tree8a87cc55ebd410e0e90963eec2e9a2e92fbbfaf2
parentb58d161703fed7eec08ec62795d92761d82a818d (diff)
downloadzsh-cbdcd62b385dea028b5312a979a3420c6fa15f98.tar.gz
zsh-cbdcd62b385dea028b5312a979a3420c6fa15f98.tar.xz
zsh-cbdcd62b385dea028b5312a979a3420c6fa15f98.zip
Moved the PROMPT_SP output into preprompt() so that it takes effect
prior to things like precmd(), the mail-check output, etc.
-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);