diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2010-07-11 08:02:26 +0000 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2010-11-02 04:14:43 +0200 |
commit | aa8281794569d238435fd1b5b2aad3549c5fa0b7 (patch) | |
tree | b9eaa25b0702322a5b40ae0857dbd83286915b1d /mp_msg.c | |
parent | 747a30b81b375b16d1f3e4f932c51ddb970da3e6 (diff) | |
download | mpv-aa8281794569d238435fd1b5b2aad3549c5fa0b7.tar.bz2 mpv-aa8281794569d238435fd1b5b2aad3549c5fa0b7.tar.xz |
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
Diffstat (limited to 'mp_msg.c')
-rw-r--r-- | mp_msg.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -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); |