changeset 31625:7c76f46056c9

Avoid status line being mangled together with error messages and other output. Patch by Dan Oscarsson [Dan.Oscarsson tieto com]
author reimar
date Sun, 11 Jul 2010 08:02:26 +0000
parents 40c30c70ead0
children 8bb62807f3b8
files mp_msg.c
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mp_msg.c	Sun Jul 11 07:37:02 2010 +0000
+++ b/mp_msg.c	Sun Jul 11 08:02:26 2010 +0000
@@ -181,6 +181,8 @@
     char tmp[MSGSIZE_MAX];
     FILE *stream = lev <= MSGL_WARN ? stderr : stdout;
     static int header = 1;
+    // indicates if last line printed was a status line
+    static int statusline;
     size_t len;
 
     if (!mp_msg_test(mod, lev)) return; // do not display
@@ -221,6 +223,11 @@
     }
 #endif
 
+    // as a status line normally is intended to be overwitten by next status line
+    // output a '\n' to get a normal message on a separate line
+    if (statusline && lev != MSGL_STATUS) fprintf(stream, "\n");
+    statusline = lev == MSGL_STATUS;
+
     if (header)
         print_msg_module(stream, mod);
     set_msg_color(stream, lev);