From aa8281794569d238435fd1b5b2aad3549c5fa0b7 Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 11 Jul 2010 08:02:26 +0000 Subject: mp_msg: avoid mangling other output with status line Output a '\n' when printing a message after a status line to move the terminal to the next line instead of writing on top of the status one. Patch by Dan Oscarsson [Dan.Oscarsson tieto com] git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31691 b3059339-0415-0410-9bf9-f77b7e298cf2 --- mp_msg.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mp_msg.c b/mp_msg.c index ff8420833f..cff4decb75 100644 --- a/mp_msg.c +++ b/mp_msg.c @@ -194,6 +194,8 @@ void mp_msg_va(int mod, int lev, const char *format, va_list va) 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; if (!mp_msg_test(mod, lev)) return; // do not display vsnprintf(tmp, MSGSIZE_MAX, format, va); @@ -231,6 +233,13 @@ void mp_msg_va(int mod, int lev, const char *format, va_list va) } #endif + /* A status line is normally intended to be overwritten by the next + * status line, and does not end with a '\n'. If we're printing a normal + * line instead after the status one print '\n' to change 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); -- cgit v1.2.3