summaryrefslogtreecommitdiffstats
path: root/common/msg.c
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2023-12-15 19:38:07 +0100
committerDudemanguy <random342@airmail.cc>2023-12-27 20:59:22 +0000
commitcadb68487e9c8f4237ba59b672180ad1460db514 (patch)
tree5dc379238569090600360e2f36340b9474147e27 /common/msg.c
parent19a37f625fcd502acea42b4f27029c8be724d40c (diff)
downloadmpv-cadb68487e9c8f4237ba59b672180ad1460db514.tar.bz2
mpv-cadb68487e9c8f4237ba59b672180ad1460db514.tar.xz
msg: keep status line on the end of file
Apparently found useful by some users. Fixes: #13092
Diffstat (limited to 'common/msg.c')
-rw-r--r--common/msg.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/common/msg.c b/common/msg.c
index b14bd5ac24..797048620b 100644
--- a/common/msg.c
+++ b/common/msg.c
@@ -247,11 +247,17 @@ static void prepare_prefix(struct mp_log_root *root, bstr *out, int lev, int ter
root->blank_lines += root->status_lines;
}
-void mp_msg_flush_status_line(struct mp_log *log)
+void mp_msg_flush_status_line(struct mp_log *log, bool clear)
{
if (log->root) {
mp_mutex_lock(&log->root->lock);
if (log->root->status_lines) {
+ if (!clear) {
+ fprintf(stderr, TERM_ESC_RESTORE_CURSOR "\n");
+ log->root->blank_lines = 0;
+ log->root->status_lines = 0;
+ goto done;
+ }
bstr term_msg = (bstr){0};
prepare_prefix(log->root, &term_msg, MSGL_STATUS, 0);
if (term_msg.len) {
@@ -259,6 +265,7 @@ void mp_msg_flush_status_line(struct mp_log *log)
talloc_free(term_msg.start);
}
}
+done:
mp_mutex_unlock(&log->root->lock);
}
}
@@ -836,7 +843,7 @@ bool mp_msg_has_log_file(struct mpv_global *global)
void mp_msg_uninit(struct mpv_global *global)
{
struct mp_log_root *root = global->log->root;
- mp_msg_flush_status_line(global->log);
+ mp_msg_flush_status_line(global->log, true);
terminate_log_file_thread(root);
mp_msg_log_buffer_destroy(root->early_buffer);
mp_msg_log_buffer_destroy(root->early_filebuffer);