From 39d3591bb2c3bc53ab9b902a3e9896fb97268fe1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= Date: Fri, 11 Oct 2024 21:05:18 +0200 Subject: [PATCH] msg: strip control char also when not printing to terminal --- common/msg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/msg.c b/common/msg.c index ca925ff72a..e98de77871 100644 --- a/common/msg.c +++ b/common/msg.c @@ -521,10 +521,11 @@ static void write_term_msg(struct mp_log *log, int lev, bstr text, bstr *out) break; } + bool clip = bstr_eatstart0(&line, TERM_MSG_0); if (print_term) { int line_w; append_terminal_line(log, lev, line, &root->term_msg_tmp, &line_w, - bstr_eatstart0(&line, TERM_MSG_0) ? term_w : INT_MAX); + clip ? term_w : INT_MAX); term_msg_lines += (!line_w || !term_w) ? 1 : (line_w + term_w - 1) / term_w; }