summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido Cella <guido@guidocella.xyz>2024-01-11 15:33:48 +0100
committerDudemanguy <random342@airmail.cc>2024-01-21 17:54:21 +0000
commit25bef997ced0365ca5212f40063185e98e0dfa6c (patch)
treeb12e782f0f120302a708c6cd3c71bc27c07dc77e
parenta39f9b6181ee54732050d64540703ca2e2c90a8d (diff)
downloadmpv-25bef997ced0365ca5212f40063185e98e0dfa6c.tar.bz2
mpv-25bef997ced0365ca5212f40063185e98e0dfa6c.tar.xz
msg: reset status_lines when setting --really-quiet
This prevents mp_msg_flush_status_line() from printing an unnecessary newline when changing file after setting --really-quiet at runtime. If mpv is backgrounded, this newline garbles the output of TUI programs. With this change the cursor is not re-enabled after setting --really-quiet at runtime and quitting with mpv in the foreground, so enable it on uninit.
-rw-r--r--common/msg.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/common/msg.c b/common/msg.c
index 20f1ce0abb..58a7b80f62 100644
--- a/common/msg.c
+++ b/common/msg.c
@@ -750,6 +750,10 @@ void mp_msg_update_msglevels(struct mpv_global *global, struct MPOpts *opts)
root->module = opts->msg_module;
root->use_terminal = opts->use_terminal;
root->show_time = opts->msg_time;
+
+ if (root->really_quiet)
+ root->status_lines = 0;
+
for (int i = STDOUT_FILENO; i <= STDERR_FILENO && root->use_terminal; ++i) {
root->isatty[i] = isatty(i);
root->color[i] = opts->msg_color && root->isatty[i];
@@ -849,6 +853,8 @@ void mp_msg_uninit(struct mpv_global *global)
{
struct mp_log_root *root = global->log->root;
mp_msg_flush_status_line(global->log, true);
+ if (root->really_quiet && root->isatty[STDERR_FILENO])
+ fprintf(stderr, TERM_ESC_RESTORE_CURSOR);
terminate_log_file_thread(root);
mp_msg_log_buffer_destroy(root->early_buffer);
mp_msg_log_buffer_destroy(root->early_filebuffer);