summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-10-24 13:13:12 +0200
committerwm4 <wm4@nowhere>2019-10-24 13:52:09 +0200
commit8721ac50fb7d779476d7cad0632cdb69fdc100e3 (patch)
tree4444742cd329477bf2028e53d3051b6425e4e2e1
parenta935109235b1032fe15a6ce790fafbcd401ecf6e (diff)
downloadmpv-8721ac50fb7d779476d7cad0632cdb69fdc100e3.tar.bz2
mpv-8721ac50fb7d779476d7cad0632cdb69fdc100e3.tar.xz
msg: always use terminal control codes for status line
Before this commit, the status line used terminal control codes only if stderr was a terminal. I'm not sure why this was done, and git blame tracks it back to a huge commit by me, which changed all of the terminal handling. A user complained, so just stop treating this specially for no reason. Fixes: #6617
-rw-r--r--common/msg.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/common/msg.c b/common/msg.c
index db786f0378..42b03ed4e9 100644
--- a/common/msg.c
+++ b/common/msg.c
@@ -50,7 +50,6 @@ struct mp_log_root {
bool use_terminal; // make accesses to stderr/stdout
bool module;
bool show_time;
- bool termosd; // use terminal control codes for status line
int blank_lines; // number of lines usable by status
int status_lines; // number of current status lines
bool color;
@@ -361,7 +360,7 @@ void mp_msg_va(struct mp_log *log, int lev, const char *format, va_list va)
} else if (lev == MSGL_STATUS && !test_terminal_level(log, lev)) {
/* discard */
} else {
- if (lev == MSGL_STATUS && root->termosd)
+ if (lev == MSGL_STATUS)
prepare_status_line(root, text);
// Split away each line. Normally we require full lines; buffer partial
@@ -382,7 +381,7 @@ void mp_msg_va(struct mp_log *log, int lev, const char *format, va_list va)
if (lev == MSGL_STATUS) {
if (text[0])
- print_terminal_line(log, lev, text, root->termosd ? "\r" : "\n");
+ print_terminal_line(log, lev, text, "\r");
} else if (text[0]) {
int size = strlen(text) + 1;
if (talloc_get_size(log->partial) < size)
@@ -510,10 +509,8 @@ 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->use_terminal) {
+ if (root->use_terminal)
root->color = opts->msg_color && isatty(STDOUT_FILENO);
- root->termosd = isatty(STDERR_FILENO);
- }
m_option_type_msglevels.free(&root->msg_levels);
m_option_type_msglevels.copy(NULL, &root->msg_levels, &opts->msg_levels);