summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndrey Borzenkov <bor@users.sourceforge.net>2007-05-10 11:36:22 +0000
committerAndrey Borzenkov <bor@users.sourceforge.net>2007-05-10 11:36:22 +0000
commitac1c48349664604fbaf5a69130be94ad0f472682 (patch)
tree741171c9915e4ce641322a65c1d75cf56d799635
parent7d700220cf49f91ba9235cc338570cf9e7bfaafc (diff)
downloadzsh-ac1c48349664604fbaf5a69130be94ad0f472682.tar.gz
zsh-ac1c48349664604fbaf5a69130be94ad0f472682.tar.xz
zsh-ac1c48349664604fbaf5a69130be94ad0f472682.zip
23409: disable prompt_sp output after ^D was seen and message printed
-rw-r--r--ChangeLog7
-rw-r--r--Src/init.c2
-rw-r--r--Src/utils.c7
3 files changed, 13 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 9e931aa82..af3b2bf3a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2007-05-10  Andrey Borzenkov <bor@zsh.org>
+
+	* 23409 with extra comment: Src/init.c, Src/utils.c: after ZLE
+	displayed "use 'exit' to exit" message, PROMPT_SP will overwrite
+	prompt without ZLE knowing about it. Disable PROMPT_SP output if
+	message was printed.
+
 2007-05-10  Peter Stephenson  <pws@csr.com>
 
 	* Peter A. Castro: 23408: zftp account handling was broken.
diff --git a/Src/init.c b/Src/init.c
index b987f1399..6c5421e6f 100644
--- a/Src/init.c
+++ b/Src/init.c
@@ -123,6 +123,7 @@ loop(int toplevel, int justonce)
 		errflag = 0;
 	    }
 	}
+	use_exit_printed = 0;
 	intr();			/* interrupts on            */
 	lexinit();              /* initialize lexical state */
 	if (!(prog = parse_event())) {	/* if we couldn't parse a list */
@@ -1335,7 +1336,6 @@ zsh_main(UNUSED(int argc), char **argv)
     init_misc();
 
     for (;;) {
-	use_exit_printed = 0;
 	/*
 	 * See if we can free up some of jobtab.
 	 * We only do this at top level, because if we are
diff --git a/Src/utils.c b/Src/utils.c
index 35915a2e7..98d441aa0 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -1156,10 +1156,13 @@ preprompt(void)
     int period = getiparam("PERIOD");
     int mailcheck = getiparam("MAILCHECK");
 
-    if (isset(PROMPTSP) && isset(PROMPTCR)) {
+    if (isset(PROMPTSP) && isset(PROMPTCR) && !use_exit_printed) {
 	/* 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). */
+	 * has automatic margins, but we try even if hasam isn't set).
+	 * Unfortunately it interacts badly with ZLE displaying message
+	 * when ^D has been pressed. So just disable PROMPT_SP logic in
+	 * this case */
 	char *str;
 	int percents = opts[PROMPTPERCENT];
 	opts[PROMPTPERCENT] = 1;