@@ -202,6 +202,17 @@ static inline FILE *term_msg_fp(struct mp_log_root *root, int lev)
202
202
return term_msg_fileno (root , lev ) == STDERR_FILENO ? stderr : stdout ;
203
203
}
204
204
205
+ static inline bool is_status_output (struct mp_log_root * root , int lev )
206
+ {
207
+ if (lev == MSGL_STATUS )
208
+ return true;
209
+ int msg_out = term_msg_fileno (root , lev );
210
+ int status_out = term_msg_fileno (root , MSGL_STATUS );
211
+ if (msg_out != status_out && root -> isatty [msg_out ] != root -> isatty [status_out ])
212
+ return false;
213
+ return true;
214
+ }
215
+
205
216
// Reposition cursor and clear lines for outputting the status line. In certain
206
217
// cases, like term OSD and subtitle display, the status can consist of
207
218
// multiple lines.
@@ -210,6 +221,9 @@ static void prepare_prefix(struct mp_log_root *root, bstr *out, int lev, int ter
210
221
int new_lines = lev == MSGL_STATUS ? term_lines : 0 ;
211
222
out -> len = 0 ;
212
223
224
+ if (!is_status_output (root , lev ))
225
+ return ;
226
+
213
227
if (!root -> isatty [term_msg_fileno (root , lev )]) {
214
228
if (root -> status_lines )
215
229
bstr_xappend (root , out , bstr0 ("\n" ));
@@ -563,7 +577,7 @@ void mp_msg_va(struct mp_log *log, int lev, const char *format, va_list va)
563
577
564
578
root -> term_status_msg .len = 0 ;
565
579
if (lev != MSGL_STATUS && root -> status_line .len && root -> status_log &&
566
- test_terminal_level (root -> status_log , MSGL_STATUS ))
580
+ is_status_output ( root , lev ) && test_terminal_level (root -> status_log , MSGL_STATUS ))
567
581
{
568
582
write_term_msg (root -> status_log , MSGL_STATUS , root -> status_line ,
569
583
& root -> term_status_msg );
0 commit comments